1. Go to this page and download the library: Download kinetis/persistence 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/ */
kinetis / persistence example snippets
use Kinetis\Persistence\ConnectionDefinition;
use Kinetis\Persistence\Contract\SqlTransaction;
use Kinetis\Persistence\SqlConnectionFactory;
use Kinetis\Persistence\TransactionGuard;
$db = SqlConnectionFactory::create(new ConnectionDefinition(
dialect: 'mysql',
host: 'db.internal',
database: 'shop',
user: 'shop',
password: $password,
));
// One guard per unit of work: a request, a job, a command.
$guard = new TransactionGuard($logger);
try {
$guard->transaction($db, static function (SqlTransaction $tx): void {
$tx->execute('UPDATE inventory SET stock = stock - 1 WHERE sku = ?', ['SKU-1']);
});
} finally {
$guard->rollbackDangling();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.