This error message usually appears when Redis PHP extension is missing or when there's a misconfiguration in Laravel. Redis works as an in-memory data structure store used for caching, message brokering, and database.
If you're using Redis in Laravel without installing the Redis PHP extension or have a misconfigured Laravel environment, you may encounter the "invalid service redis class redis does not exist" error. The error happens when Laravel fails to find the Redis class because either Redis PHP extension is absent, or it's incorrectly set up.
To fix this error, you need to install and enable Redis PHP extensions on your server configuration. For Linux OS, use package managers like apt or yum, while Homebrew is recommended for macOS.
After installation, ensure that Redis PHP extension is enabled in php.ini file, or the appropriate configuration file for the webserver. Also, double-check if Laravel settings are correctly configured to use Redis with the right port, host, and password where necessary. Finally, restart your PHP service or webserver to apply any changes made to the configuration files.