1. Go to this page and download the library: Download php-kit/ext-pdo 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/ */
php-kit / ext-pdo example snippets
use PhpKit\ExtPDO\ExtPDO;
$pdo = ExtPDO::create('mysql', [
'host' => '127.0.0.1',
'database' => 'app',
'username' => 'app_user',
'password' => 'secret',
'charset' => 'utf8mb4',
]);
$pdo->beginTransaction();
try {
// Run parameterized statements without manual statement preparation.
$pdo->exec('INSERT INTO posts (title, body) VALUES (?, ?)', ['Hello', 'First post']);
// Quickly fetch a single value.
$postCount = $pdo->get('SELECT COUNT(*) FROM posts');
// Or work with a full result set.
$statement = $pdo->select('SELECT * FROM posts WHERE id = ?', [1]);
$post = $statement->fetch();
$pdo->commit();
} catch (Throwable $e) {
$pdo->rollBack();
throw $e;
}
use PhpKit\ExtPDO\Connections;
$connections = new Connections();
// Reads DB_DRIVER, DB_HOST, DB_DATABASE, DB_USERNAME, etc. from the environment.
$default = $connections->get();
// Register additional named connections when needed.
$connections->register('reporting', function () {
// Build and return a Connection instance here.
});
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.