PHP code example of phpwatch / laravel-fast404

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

    

phpwatch / laravel-fast404 example snippets



return [
    // ...
    'fast404' => [
        'message' => 'Not Found',
        'regex' => '',
        'exclude_regex' => '',
    ],
];



class Kernel extends HttpKernel
{
    //
    protected $middleware = [
        \PHPWatch\LaravelFast404\Fast404Middleware::class,
        // other middleware
    ];
    // ...
}

// at the top
use PHPWatch\LaravelFast404\Fast404Middleware;



// in register() method:
$this->app->bind(Fast404Middleware::class, static function ($app): Fast404Middleware {
          return new Fast404Middleware('Not Found', '/\.(?:js|css|jpg|jpeg|gif|png|webp|ico|exe|bin|dmg|woff|woff2)$/i');
        });