PHP code example of travy / cake-tracking

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

    

travy / cake-tracking example snippets


class Application extends BaseApplication
{
    public function middleware($middlewareQueue)
    {
        $middlewareQueue
            ->add(ErrorHandlerMiddleware::class)
            ->add(AssetMiddleware::class)
            ->add(new RoutingMiddleware($this))
                
            //  add the TrackingMiddleware to the queue
            ->add(new \CakeTracking\Middleware\TrackingMiddleware());

        return $middlewareQueue;
    }
}

class Application extends BaseApplication
{
    public function middleware($middlewareQueue)
    {
        //  supply the custom classes to the TrackingMiddleware object
        $trackingMiddleware = new \CakeTracking\Middleware\TrackingMiddleware();
        $trackingMiddleware->setBlacklistRepository(new BlacklistDatabaseRepository($configs));
        $trackingMiddleware->setLoggingOperation(new TrackingDatabaseLoggin($configs));
    
        $middlewareQueue
            ->add(ErrorHandlerMiddleware::class)
            ->add(AssetMiddleware::class)
            ->add(new RoutingMiddleware($this))
                
            //  supply the instantiated tracker to the queue
            ->add($trackingMiddleware);

        return $middlewareQueue;
    }
}