Skip to main content
With Laravel, you can use Redis to handle session storage, cache storage, and queues.

1. Add the Redis service

  1. Add the service to your app configuration using the services top-level key:
    .upsun/config.yaml
    services:
      [...]
      redis:
        type: redis:7.0
    
  2. To connect the service to your app, add the following relationship:
    .upsun/config.yaml
    applications:
      myapp:
        [...]
        relationships:
          redis:
    
    services:
      [...]
      redis:
        type: redis:7.0
    

2. Configure your Redis service

The Redis configuration is exposed via the following environment variables (where REDIS is the upper-cased version of the key defined in the relationship):
  • REDIS_URL: The Redis URL
  • REDIS_HOST: The Redis host
  • REDIS_PORT: The Redis port
  • REDIS_SCHEME: The Redis scheme
If the relationship is named redis, Laravel automatically detects these variables and configure its own Redis driver the right way. If not, you can map the variables in the .environment file. You can specify the Redis client in your .environment file:
.environment
export REDIS_CLIENT="phpredis"
If using phpredis, make sure you add redis in the list of PHP runtime extensions in your .upsun/config.yaml:
.upsun/config.yaml
applications:
  myapp:
    [...]
    runtime:
      extensions:
        - redis

3. Store the Laravel cache in Redis

To enable cache storage in Redis, add the following environment variable to your .environment file:
.environment
export CACHE_STORE="redis"

4. Store Laravel sessions in Redis

Laravel relies on the SESSION_DRIVER variable to store sessions. Therefore, add the following environment variable to your .environment file:
.environment
export SESSION_DRIVER="redis"

5. Use Redis for Laravel queues

For a basic queueing system, configure the QUEUE_CONNECTION in your .environment file as follows:
.environment
export QUEUE_CONNECTION="redis"
For more information, see the Laravel Queues documentation and Upsun’s Horizon configuration page.
Last modified on March 10, 2026