krisell / cosmos-cache-driver
CosmosDB cache driver for Laravel
Installs: 3 070
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 3
Requires (Dev)
- orchestra/testbench: ^3.5
- phpunit/phpunit: ^8.2
This package is auto-updated.
Last update: 2024-11-06 18:13:37 UTC
README
This package adds support to use Microsoft Azure CosmosDB as a cache driver for your Laravel project. It uses the MongoDB-API, so make sure you configure that on the Azure end.
Prerequisities
Make sure you have a driver for the mongodb connection installed, for instance jenssegers/mongodb
. Note that you also need to enable the pecl extension for mongodb.
Configuration
Add the following configurations
database.php
'cosmos' => [ 'driver' => 'mongodb', 'database' => env('COSMOS_DATABASE'), 'dsn' => env('COSMOS_CONNECTION'), ],
cache.php
'cosmos' => [ 'driver' => 'cosmos', 'table' => env('COSMOS_TABLE', 'cache_'.config('app.env')), ],
So, in your .env, add
COSMOS_DATABASE=database_name
COSMOS_CONNECTION=database_connection_string (something like mongodb://)
COSMOS_TABLE=table_name (optional, defaults to cache_{{env}})
The database and table are created automatically by CosmosDB.