PHP code example of lapaz / odango

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

    

lapaz / odango example snippets


$withLoggedTransaction = AdviceComposite::of(
    function ($invocation) use ($logger) {
        $logger->info('Starting transaction.');
        $result = $invocation->proceed();
        $logger->info('Transaction comitted.');
        return $result;
    }
)->with(
    function ($invocation) use ($db) {
        $db->beginTransaction();
        try {
            $result = $invocation->proceed();
            $db->commit();
            return $result;
        } catch (\Exception $ex) {
            $dbh->rollBack();
            throw $ex;
        }
    }
);

$storeDataInvocation = [$this, 'storeData']; // Some callable
$storeDataInvocation = $withLoggedTransaction->bind($storeDataInvocation);

$storeDataInvocation($data);