PHP code example of henzeb / laravel-pennant-cache

1. Go to this page and download the library: Download henzeb/laravel-pennant-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

henzeb / laravel-pennant-cache example snippets


'stores' => [
    'cache' => [
        'driver' => 'cache',
        'store' => 'redis',
    ],
],

> 'stores' => [
>     'pennant' => [
>         'driver' => 'redis',
>         'connection' => 'pennant',
>     ],
> ],
> 

'stores' => [
    'cache' => [
        'driver' => 'cache',
        'store' => 'redis',
        'prefix' => 'my-app-features',
        'ttl' => 3600,
    ],
],

Feature::store('cache')->for($user)->activate('discount', ['percentage' => 10]);

Feature::store('cache')->for($user)->deactivate('discount');
Feature::store('cache')->for($user)->value('discount'); // false

Feature::store('cache')->for($user)->activate('discount');
Feature::store('cache')->for($user)->value('discount'); // ['percentage' => 10] again