PHP code example of triopsi / banned-tool

1. Go to this page and download the library: Download triopsi/banned-tool 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/ */

    

triopsi / banned-tool example snippets


$this->addPlugin('BannedTool');

use BannedTool\Middleware\BannedMiddleware;
use Cake\View\View;

public function middleware( MiddlewareQueue $middlewareQueue ): MiddlewareQueue {
    ...
    ->add(
        new BannedMiddleware(
            array(
            'className' => View::class,
            'templatePath' => 'Error',
            'statusCode' => 403,
            'templateLayout' => false,
            'templateFileName' => 'banned',
            'templateExtension' => '.php',
            'contentType' => 'text/html',
            )
        )
        ...
)

// In your App Controller Class (src/Controller/AppController)
public function initialize() {
    ...
    $this->loadComponent('BannedTool.Banned');
}