PHP code example of josegonzalez / app

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

    

josegonzalez / app example snippets


EventManager::instance()->on('Bake.beforeRender.Model.table', function (Event $event) {
    $view = $event->subject();
    $name = Hash::get($view->viewVars, 'name', null);
    if ($name == 'Users') {
        $behaviors = Hash::normalize(Hash::get($view->viewVars, 'behaviors', []));
        $behaviors['Josegonzalez/Upload.Upload'] = ['photo' => []];
        $view->set('behaviors', $behaviors);
    }
});

[
    'Error' => [
        'config' => [
            'handlers' => [
                // configuring the BugsnagHandler via an env var
                'BugsnagHandler' => [
                    'apiKey' => env('BUGSNAG_APIKEY', null)
                ],
            ],
        ],
    ],
];

// assuming mysql engine
use josegonzalez\Queuesadilla\Engine\MysqlEngine;
use josegonzalez\Queuesadilla\Queue;

// get the engine config:
$config = Configure::read('Queuesadilla.engine');

// instantiate the things
$engine = new MysqlEngine($config);
$queue = new Queue($engine);

// a function in the global scope
function some_job($job)
{
    var_dump($job->data());
}
$queue->push('some_job', [
    'id' => 7,
    'message' => 'hi'
]);