Download the PHP package jobverplanke/craftcms-components without Composer
On this page you can find all versions of the php package jobverplanke/craftcms-components. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jobverplanke/craftcms-components
More information about jobverplanke/craftcms-components
Files in jobverplanke/craftcms-components
Package craftcms-components
Short Description Simple driver setup for CraftCMS components queue, cache or session
License MIT
Informations about the package craftcms-components
Introduction
Simple driver setup for CraftCMS components queue, cache or session for CraftCMS v4 and v5.
Available components and drivers
Redis | Database | |
---|---|---|
Cache | :white_check_mark: | :white_check_mark: |
Queue | :white_check_mark: | :x: (default driver) |
Session | :white_check_mark: | :white_check_mark: |
[!NOTE] Craft's default queue driver is the database. Do not configure the queue component in the app.php if you want to make use of the database queue driver.
Craft v4: https://craftcms.com/docs/4.x/config/app.html#queue
Craft v5: https://craftcms.com/docs/5.x/reference/config/app.html#queue
Installation
Make sure that the yiisoft/yii2-redis
package is installed when utilizing Redis
Configuration
To make use of a different driver per component is a breeze. Just specify the desired driver for the component you want to use in the components
config array in either config/app.php
or config/app.web.php
(session only).
Database configuration
In order to use the database
driver, configure CraftCMS as followed
Cache component
Queue component
Session component
Redis configuration
If you want to use the Redis
driver for a specific component, make sure Redis is configured
- Add the Redis component to the
app.php
, see example below - Enable Redis by adding the following environment variables
REDIS_URL=
ORREDIS_HOST
,REDIS_PORT
andREDIS_PASSWORD
[!NOTE]
REDIS_URL
takes precedence overREDIS_HOST
,REDIS_PORT
andREDIS_PASSWORD
.
Cache component
Queue component
Session component
Environment Variable Configuration
The following environment variables are available for further configuration of the components
It's recommended to leave the following set to false
when using Heroku. Heroku issue and Github issue
REDIS_SSL
REDIS_SSL_VERIFY_PEER
REDIS_SSL_VERIFY_PEER_NAME
Required | Type | Default Value | Description / Remark | |
---|---|---|---|---|
CRAFT_CACHE_DRIVER |
:white_check_mark: | string | Possible values redis or database |
|
CRAFT_SESSION_DRIVER |
:white_check_mark: | string | Possible values redis or database |
|
CRAFT_QUEUE_DRIVER |
:white_check_mark: | string | Possible values redis or database |
|
REDIS_URL |
:white_check_mark: | string | Takes precedence over REDIS_HOST , REDIS_PORT and REDIS_PASSWORD . |
|
REDIS_HOST |
string | Only when REDIS_URL is not used |
||
REDIS_PORT |
string | 6379 | Only when REDIS_URL is not used |
|
REDIS_PASSWORD |
string | Only when REDIS_URL is not used |
||
REDIS_DB |
integer | 0 | Default database to use, this database will be used for all Redis connections | |
REDIS_RETRIES |
integer | 1 | Th..ount of times to retry connecting after connection has timed out | |
REDIS_SSL |
boolean | false | Use SSL connection when connecting with Redis. Recommended to use false when using Heroku |
|
REDIS_SSL_VERIFY_PEER |
boolean | false | Verify peer SSL certificate. Recommended to use false when using Heroku |
|
REDIS_SSL_VERIFY_PEER_NAME |
boolean | false | Verify peer name of SSL certificate. Recommended to use false when using Heroku |
|
REDIS_CACHE_DB |
integer | 1 | Which database to use for the cache database. Make sure the cache database is separated from the queue and session database | |
REDIS_QUEUE_DB |
integer | 3 | Which database to use for the queue database | |
REDIS_QUEUE_CHANNEL |
string | queue | Queue channel to use | |
REDIS_QUEUE_TTR |
integer | 300 | Max time for job execution, unit in seconds | |
REDIS_QUEUE_ATTEMPTS |
integer | 3 | Max number of attempts | |
REDIS_SESSION_DB |
integer | 1 | Which database to use for the session database. |