PHP code example of fahlisaputra / laravel-minify

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

    

fahlisaputra / laravel-minify example snippets


protected $middleware = [
    ....
    // Middleware to minify CSS
    \Fahlisaputra\Minify\Middleware\MinifyCss::class,
    // Middleware to minify Javascript
    \Fahlisaputra\Minify\Middleware\MinifyJavascript::class,
    // Middleware to minify Blade
    \Fahlisaputra\Minify\Middleware\MinifyHtml::class,
];

->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \Fahlisaputra\Minify\Middleware\MinifyHtml::class,
        \Fahlisaputra\Minify\Middleware\MinifyCss::class,
        \Fahlisaputra\Minify\Middleware\MinifyJavascript::class,
    ]);
})

"assets_enabled" => env("MINIFY_ASSETS_ENABLED", true),

"insert_semicolon" => [
    'css' => env("MINIFY_CSS_SEMICOLON", true),
    'js' => env("MINIFY_JS_SEMICOLON", true),
],

return view('welcome', ['ignore_minify' => true]);

"ignore" => [
    '/admin'
],

"directives" => [
    '@' => 'x-on:',
],

"keep_directives" => [
    '@vite'
],
sh
php artisan vendor:publish --provider="Fahlisaputra\Minify\MinifyServiceProvider"