PHP code example of phpwatch / fast404

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



$container[Fast404Middleware::class] = static function (Container $container) {  
  return new Fast404Middleware();  
};


use PHPWatch\Fast404\Fast404Middleware;

$app->add(Fast404Middleware::class); // For whole app
$app->get/users/{username},...)->add(Fast404Middleware::class); // Or, for individual routes


new Fast404Middleware(string $error_message = 'Not found', string $regex = null, ?string $exclude_regex = null)