PHP code example of muffin / footprint

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

    

muffin / footprint example snippets


$middleware->add('Muffin/Footprint.Footprint');

$this->addBehavior('Muffin/Footprint.Footprint');

$this->addBehavior('Muffin/Footprint.Footprint', [
    'events' => [
        'Model.beforeSave' => [
            'user_id' => 'new',
            'company_id' => 'new',
            'modified_by' => 'always'
        ]
    ],
    'propertiesMap' => [
        'company_id' => '_footprint.company.id',
    ],
]);

$this->addBehavior('Muffin/Footprint.Footprint', [
    'events' => [
        'Model.beforeSave' => [
            'user_id' => 'new',
            'company_id' => 'new',
            'modified_by' => 'always',
            'deleted_by' => function ($entity): bool {
                return $entity->deleted !== null;
            },
        ]
    ],
]);

use Authentication\Middleware\AuthenticationMiddleware;
use Cake\Event\EventInterface;
use Cake\Http\MiddlewareQueue;
use Muffin\Footprint\Middleware\FootprintMiddleware;

// inside the bootstrap() method
$this->getEventManager()->on(
    'Server.buildMiddleware',
    function (EventInterface $event, MiddlewareQueue $middleware) {
        $middleware->insertAfter(AuthenticationMiddleware::class, FootprintMiddleware::class);
    }
);