PHP code example of brucedeity / laravel-page-speed
1. Go to this page and download the library: Download brucedeity/laravel-page-speed 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/ */
brucedeity / laravel-page-speed example snippets
//app/Http/Kernel.php
protected $middleware = [
...
\brucedeity\LaravelPageSpeed\Middleware\InlineCss::class,
\brucedeity\LaravelPageSpeed\Middleware\ElideAttributes::class,
\brucedeity\LaravelPageSpeed\Middleware\InsertDNSPrefetch::class,
\brucedeity\LaravelPageSpeed\Middleware\RemoveComments::class,
//\brucedeity\LaravelPageSpeed\Middleware\TrimUrls::class,
//\brucedeity\LaravelPageSpeed\Middleware\RemoveQuotes::class,
\brucedeity\LaravelPageSpeed\Middleware\CollapseWhitespace::class, // Note: This middleware invokes "RemoveComments::class" before it runs.
\brucedeity\LaravelPageSpeed\Middleware\DeferJavascript::class,
]
//config/laravel-page-speed.php
//Set this field to false to disable the laravel page speed service.
'enable' => env('LARAVEL_PAGE_SPEED_ENABLE', true),
//config/laravel-page-speed.php
//You can use * as wildcard.
'skip' => [
'*.pdf', //Ignore all routes with final .pdf
'*/downloads/*',//Ignore all routes that contain 'downloads'
'assets/*', // Ignore all routes with the 'assets' prefix
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.