PHP code example of egamipeaks / pizzazz

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

    

egamipeaks / pizzazz example snippets


return [
    // Whether to enable Pizzazz
    'enabled' => env('PIZZAZZ_ENABLED', true),

    // Whether to enable debug mode
    'debug' => env('PIZZAZZ_DEBUG', false),

    // Add query vars that stop caching
    'disallowed_query_vars' => [],

    // Whether to cache authenticated requests
    'cache_authenticated_requests' => env('PIZZAZZ_CACHE_AUTHENTICATED_REQUESTS', false),

    // Minimum content length 

// In routes/web.php
Route::middleware('page-cache')->group(function () {
    Route::get('/', [HomeController::class, 'index']);
    Route::get('/about', [AboutController::class, 'index']);
    // Add more routes that should be cached
});

protected $middleware = [
    // ... other middleware
    \EgamiPeaks\Pizzazz\Middleware\PageCacheMiddleware::class,
];

use EgamiPeaks\Pizzazz\Pizzazz;

// Check if a request can be cached
$pizzazz = app(Pizzazz::class);
$canCache = $pizzazz->canCache($request);

// Get cached content
$cachedContent = $pizzazz->getCache($request);

use EgamiPeaks\Pizzazz\Services\PageCacheFlusher;

// Flush all cached pages
$flusher = app(PageCacheFlusher::class);
$flusher->flush();

// In config/pizzazz.php
'disallowed_query_vars' => ['utm_source', 'utm_medium', 'debug'],

// In config/pizzazz.php
'
bash
php artisan vendor:publish --tag="pizzazz-config"
bash
php artisan pizzazz:flush