laravel-cache-fallback icon indicating copy to clipboard operation
laravel-cache-fallback copied to clipboard

Support Laravel 9.x

Open andreypopov opened this issue 3 years ago • 4 comments

Problem 1 - Root composer.json requires mathieu-bour/laravel-cache-fallback * -> satisfiable by mathieu-bour/laravel-cache-fallback[dev-dependabot/composer/league/flysystem-1.1.4, dev-dependabot/composer/laravel/framework-8.40.0, dev-main, 1.0.0, 9999999-dev]. - mathieu-bour/laravel-cache-fallback[dev-dependabot/composer/league/flysystem-1.1.4, dev-dependabot/composer/laravel/framework-8.40.0, dev-main, 1.0.0] require illuminate/support 5.8.* || ^6.0 || ^7.0 || ^8.0 -> found illuminate/support[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but it conflicts with your root composer.json require (^9).

andreypopov avatar Feb 17 '22 14:02 andreypopov

I managed to get this working with Laravel 9.

  1. I didn't use composer to install but rather copy/pasted all 3 files from the src folder into my project folder for example in yourCustomFolder\Providers\CacheFallback which is on the same level as the app folder

  2. Then I registered the CacheFallbackServiceProvider inside config\app.php yourCustomFolder\Providers\CacheFallback\CacheFallbackServiceProvider::class

  3. after that modify your redis config inside config\cache.php in the redis array add this line 'fallback' => 'file'

  4. Update the namespaces in the 3 files you copied for example in RepositoryProxy.php yourCustomFolder\Providers\CacheFallback

  5. Then inside the RepositoryProxy.php update the get method like so on line 83 public function get($key, $default = null): mixed

  6. Last step is to add this line inside RepositoryProxy.php just under line 63 $config->set("cache.default", $fallback);

After that you can stop your Redis server and the file cache should be used.

p-holodynski avatar Feb 17 '22 17:02 p-holodynski

Yes, this library is sadly not compatible with Laravel 9... I'll try to update it this week-end.

matbour avatar Feb 17 '22 18:02 matbour

any luck?

andreypopov avatar Mar 07 '22 09:03 andreypopov

@andreypopov Did you try my method? I used it at my company and we are using this package now without problems.

p-holodynski avatar Mar 07 '22 23:03 p-holodynski