PHP code example of eyadhamza / laravel-webp

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

    

eyadhamza / laravel-webp example snippets


return [
    'quality' => 70,
    'height' => null,
    'width' => null,
    'overwrite' => true
];

class TestModel extends Model
{
    protected $casts = [
        'image' => ToWebpCast::class . ':200,200,100',
        'avatar' => ToWebpCast::class,
    ];
}
bash
php artisan vendor:publish --provider="EyadHamza\LaravelWebp\LaravelWebpServiceProvider" --tag="webp-config"
bash
php artisan public:to-webp
bash
php artisan public:to-webp --overwrite
bash
php artisan public:to-webp --assets