PHP code example of kwhorne / askr-laravel

1. Go to this page and download the library: Download kwhorne/askr-laravel 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/ */

    

kwhorne / askr-laravel example snippets


// config/cache.php → 'stores'
'askr' => ['driver' => 'askr'],

// config/queue.php → 'connections'
'askr' => ['driver' => 'askr', 'queue' => 'default', 'retry_after' => 90],

Route::get('/products/{product}', ProductController::class)
    ->middleware('askr.cache:300');              // fresh 300s

Route::get('/', HomeController::class)
    ->middleware('askr.cache:300,60,86400');     // ttl, swr, stale-if-error
bash
askr serve \
  --root public --worker-script vendor/askr/worker.php \
  --workers auto \
  --cache-slots 16384 --cache-large-slots 4096 \
  --queue-slots 8192