Skip to content

Commit 77ca7d3

Browse files
feat: add usage examples for all drivers
Create explicit, self-contained examples for: - MySQL (PDO, Doctrine DBAL) - Redis (Ext-Redis, Predis) - Mongo (MongoDB\Database) Each example demonstrates explicit driver instantiation, adapter wrapping, and retrieval via getDriver(). Examples are intentionally devoid of autoloaders or bootstrap logic to emphasize their role as snippet references for integration.
1 parent 0358894 commit 77ca7d3

5 files changed

Lines changed: 2 additions & 10 deletions

File tree

examples/mongo/database.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
declare(strict_types=1);
44

5-
require __DIR__ . '/../../vendor/autoload.php';
6-
75
use Maatify\DataAdapters\Adapters\Mongo\MongoDatabaseAdapter;
86
use MongoDB\Client;
97

examples/mysql/dbal.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
declare(strict_types=1);
44

5-
require __DIR__ . '/../../vendor/autoload.php';
6-
75
use Doctrine\DBAL\DriverManager;
86
use Maatify\DataAdapters\Adapters\MySQL\MySQLDBALAdapter;
97

8+
// DBAL connection creation is the application's responsibility
109
// Create DBAL Connection explicitly
1110
$connection = DriverManager::getConnection([
1211
'dbname' => 'test_db',

examples/mysql/pdo.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
declare(strict_types=1);
44

5-
require __DIR__ . '/../../vendor/autoload.php';
6-
75
use Maatify\DataAdapters\Adapters\MySQL\MySQLPDOAdapter;
86

97
// Create PDO explicitly

examples/redis/ext-redis.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
declare(strict_types=1);
44

5-
require __DIR__ . '/../../vendor/autoload.php';
6-
75
use Maatify\DataAdapters\Adapters\Redis\RedisAdapter;
6+
use Redis;
87

98
// Create Redis explicitly
109
$redis = new Redis();

examples/redis/predis.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
declare(strict_types=1);
44

5-
require __DIR__ . '/../../vendor/autoload.php';
6-
75
use Maatify\DataAdapters\Adapters\Redis\RedisPredisAdapter;
86
use Predis\Client;
97

0 commit comments

Comments
 (0)