PHP code example of gotoeveryone / cake-parts

1. Go to this page and download the library: Download gotoeveryone/cake-parts 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/ */

    

gotoeveryone / cake-parts example snippets


use Gotoeveryone\Middleware\TraceMiddleware;
use Gotoeveryone\Middleware\TransactionMiddleware;

public function middleware($middlewareQueue)
{
    // Add to middlewareQueue.
    $middlewareQueue
        ->add(new TraceMiddleware())
        ->add(new TransactionMiddleware('connection name'));

    return $middlewareQueue;
}

use Gotoeveryone\Middleware\TraceMiddleware;
use Gotoeveryone\Middleware\TransactionMiddleware;

Router::scope('/', function ($routes) {
    // Register middleware
    $routes->registerMiddleware('trace', new TraceMiddleware())
        ->registerMiddleware('transaction', new TransactionMiddleware('connection name'))
        ->applyMiddleware('trace', 'transaction');
});