1
votes

I am trying to use predis in laravel 5.2.I have installed predis and redis via composer.json in require as predis" :"~1.0".Then I did composer update and also ran composer require illuminate/redis to pull redis files.

but when i am using in my controller(showing only related code)

//Code
use Redis;
function index(){
      Redis::set("masterpowers", "Yeah Baby Yeah");
      print_r(Redis::get("masterpowers"));
}
//Code ends

Its showing error in localhost as well as in terminal-

FatalErrorException in ProviderRepository.php line 146: Class 'lluminate\Redis\RedisServiceProvider' not found

I have installed redis client too and my command redis-cli ping working fine.

2
on your vendor folder under Illuminate folder is Redis directory available?Muhammad Sumon Molla Selim
Check to make sure you have 'Redis' => Illuminate\Support\Facades\Redis::class, in config/app.php, and also that you have Redis.php in vendor/laravel/framework/src/Illuminate/Supports/Facades.Samsquanch
It should be "predis/predis": "^1.1" in the the composer.jsonRonald

2 Answers

1
votes

By default in laravel framework, RedisServiceProvider is already configured in config/app as well as its Facade.

Remove the line of predis in your composer.json and run this:

composer require predis/predis

You may have missed the actual package by updating the composer.json alone.

0
votes

Make sure in your config/app.php file that Illuminate\Redis\RedisServiceProvider::class is listed under providers, then run terminal command composer dump-autoload (regardless if class is found or not).