kreait / firebase-tokens-php

A PHP library to work with Firebase tokens
MIT License
223 stars 33 forks source link

Cache for Laravel? #23

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi there,

I was wondering if you know of a way to use the cache ie

use Symfony\Component\Cache\Simple\FilesystemCache;

$cache = new FilesystemCache();

with the Laravel wrapper which is built on top of Symfony?

I tried to send do it like this but got an error:

$verifier = IdTokenVerifier::createWithProjectIdAndCache($projectId, 
            \Illuminate\Support\Facades\Cache::class);

Error: "The cache must implement Psr\\SimpleCache\\CacheInterface or Psr\\Cache\\CacheItemPoolInterface

ghost commented 4 years ago

Figured it out:

$cache =  Cache::store(config('cache.default'));
$verifier = IdTokenVerifier::createWithProjectIdAndCache($projectId, $cache);