Skip to content

Google Lighthouse wrapper for laravel framework to run Google Lighthouse CLI with custom option and can automatically save result in your server directory

License

Notifications You must be signed in to change notification settings

adityadees/laravel-lighthouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-lighthouse

A Google Lighthouse wrapper for laravel framework which can make it easier for you to run Google Lighthouse to audit websites. The audit results that have been completed will be saved automatically in your server directory.

run composer require adityadees/laravel-lighthouse then php artisan vendor:publish --tag=laravel-lighthouse

Before use this package you need define variable on config/laravel-lighthouse.php as global config

To use it you can run

# $url = optional, you can using global config or override it to this variable
# $device = optional, if blank will scan both, mobile and desktop mode
$lighouse = (new LaravelLighthouse())->run($url,$device);

// using default config option
$lighouse = (new LaravelLighthouse())->run();

// run both mobile and desktop
$lighouse = (new LaravelLighthouse())->run('https://adityadees.com');

// run only mobile
$lighouse = (new LaravelLighthouse())->run('https://adityadees.com', 'mobile');

// run only desktop
$lighouse = (new LaravelLighthouse())->run('https://adityadees.com', 'desktop');

// run only mobile with global url defined on config
$lighouse = (new LaravelLighthouse())->run('', 'mobile');

// run only desktop with global url defined on config
$lighouse = (new LaravelLighthouse())->run('', 'desktop');

or you can use your own custom configuration like this

# $url = optional, you can using global config or override it to this variable
# $flag = optional, you can use the config or define it on here
# $device = optional, if blank will scan both, mobile and desktop mode
$lighouse = (new LaravelLighthouse())->selfConfiguration($url,$flag,$device);


// using self configuration with config as default
$lighouse = (new LaravelLighthouse())->selfConfiguration('https://adityadees.com');

// run self configuration with override url, flag and both device
$lighouse = (new LaravelLighthouse())->selfConfiguration('https://adityadees.com', '--chrome-flags="--headless --no-sandbox --disable-gpu" --output html --output json --output-path ' . base_path() . '/public/laravel-lighthouse/mobile/result.html');

// run self configuration with override url, flag and device to mobile mode
$lighouse = (new LaravelLighthouse())->selfConfiguration('https://adityadees.com', '--chrome-flags="--headless --no-sandbox --disable-gpu" --output html --output json --output-path ' . base_path() . '/public/laravel-lighthouse/mobile/result.html', 'mobile');

// run self configuration with override url, flag and device to dekstop mode
$lighouse = (new LaravelLighthouse())->selfConfiguration('https://adityadees.com', '--chrome-flags="--headless --no-sandbox --disable-gpu" --preset=desktop --output html --output json --output-path ' . base_path() . '/public/laravel-lighthouse/desktop/result.html', 'desktop');

for more information about the flag you can visit https://github.com/GoogleChrome/lighthouse

if you following the configuration example the results should be like this

  • Inside folder public you can see the results .html and .json

https://github.com/adityadees/laravel-lighthouse/tree/docs/example-results/laravel-lighthouse

image

if you open the .html you can see the results like this

Desktop

image

Mobile image

About

Google Lighthouse wrapper for laravel framework to run Google Lighthouse CLI with custom option and can automatically save result in your server directory

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages