RabbitLoader Laravel package can be used to speed up any website that is built using Laravel framework.
- 🚀 Boost PageSpeed Insights Score for all pages of the Laravel website
- 🏗️ Automatically reduce image size by ~40% by converting to NextGen AVIF and WebP formats
- ➰ Lazy load below-the-fold images and YouTube videos
- 📱 Reduce CSS size by 98% automatically by generating critical-css for fastest rendering of the webpage
- ✨ Improve all Core Web Vitals metrics (lower FCP, FID, and CLS)
- ⚡️ Higher rankings on Google Search and better conversions due to page speed optimization and healthy Core Web Vitals metrics
- 🌐 Cache and serve static assets (CSS/JS/Images) via inbuilt premium CDN
- ♾️ HTTP/3 Full request and response multiplexing of static assets
- 🗜️ Use Brotli compression for static assets transfer and loading
The package can be installed using Composer.
composer require rabbit-loader/laravelRun the below command to publish the vender assets and configurations.
php artisan vendor:publish --provider='RabbitLoader\Laravel\RLServiceProvider'In the app/Http/Kernel.php file, add the RabbitLoader middleware.
//app/Http/Kernel.php
protected $middleware = [
...
\RabbitLoader\Laravel\Process::class
...
]The configuration file can be found under the Laravel project installation directory config/rabbitloader.php
Below is a sample configuration file. The configuration items are self explanatory.
<?php
return [
// boolean - sets RabbitLoader optimization
'active' => env('RABBIT_LOADER_ACTIVE', true),
//boolean - if true, RL will work in me(private) mode. production ready app should have this value false
'meMode' => env('RABBIT_LOADER_ME_MODE', false),
//set the license key here if you can not use .env file.
'licenseKey' => env('RABBIT_LOADER_LICENSE_KEY', ''),
//directory where cached files can be stored
'cacheDir' => env('RABBIT_LOADER_CACHE_DIR', '/tmp'),
//skip RabbitLoader for these paths
'skipPaths' => ['/my-admin*', '/some-path'],
//skip RabbitLoader is these cookie keys are present
'skipCookies' => ['user_id'],
//these parameters will be ignored when looking for cached data. Analytics parameters are good fit here because they do not affect the backend page structure
'ignoreParams' => ['utm_source', 'utm_medium',],
];If you change configuration on environment variables, its a good idea to clear the cached content using the below command -
php artisan config:clearA license key is required to run the SDK. This guide explains how to get the license key.
After getting the license key, you can keep it in the .env file
RABBIT_LOADER_LICENSE_KEY='license key goes here'