cycle / database
DBAL, schema introspection, migration and pagination
Fund package maintenance!
2.24.0
2026-11-21 11:29 UTC
Requires
- php: >=8.2
- ext-pdo: *
- psr/log: 1 - 3
- spiral/core: ^2.14 || ^3.14
- spiral/pagination: ^2.14 || ^3.14
- symfony/polyfill-php83: ^1.43
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.9
- buggregator/trap: ^1.20
- cycle/testing: ^0.1.2
- ergebnis/composer-normalize: ^2.58
- llm/skills: ^1.20
- mockery/mockery: ^1.6
- roxblnfk/unpoly: ^1.8
- testo/bridge-mockery: ^0.1.2
- testo/testo: ^0.10.60
Suggests
None
Provides
None
Conflicts
Replaces
None
- 2.x-dev
- 2.24.0
- 2.23.5
- 2.23.4
- 2.23.3
- 2.23.2
- 2.23.1
- 2.23.0
- 2.22.1
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.2
- 2.15.1
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.3
- 2.11.2
- 2.11.1
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.1
- 2.8.0
- 2.7.1
- 2.7.0
- 2.6.1
- 2.6.0
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.0
- 1.x-dev
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-fix/mysql-add-autoincrement-column
- dev-fix/277-mysql-datetime-precision-now
- dev-feature/upsert
- dev-ulid-idenitifer-2.x
- dev-feat/automate-changelog
- dev-feat/infra-dx-v2
- dev-feat/infra-dx
- dev-feat/dx
- dev-feature/alias
- dev-hotfix/strict-type
- dev-driver-enhancments
- dev-feature/oracle
- dev-feature/oracle-support
This package is auto-updated.
Last update: 2026-11-22 10:15:02 UTC
README
Cycle DBAL: database abstraction layer, schema introspection, migrations and pagination
Secure, multiple SQL dialects (MySQL, PostgreSQL, SQLite, SQLServer), schema introspection, schema declaration, smart identifier wrappers, database partitions, query builders, nested queries.
Get Started
Requirements
Make sure that your server is configured with following PHP version and extensions:
- PHP 8.2+
- PDO Extension with desired database drivers
Installation
composer require cycle/database
Example
Given example demonstrates the connection to SQLite database, creation of table schema, data insertion and selection:
<?php declare(strict_types=1); require_once "vendor/autoload.php"; use Cycle\Database\Config; use Cycle\Database\DatabaseManager; $dbm = new DatabaseManager(new Config\DatabaseConfig([ 'databases' => [ 'default' => ['connection' => 'sqlite'], ], 'connections' => [ 'sqlite' => new Config\SQLiteDriverConfig( connection: new Config\SQLite\FileConnectionConfig( database: 'runtime/database.db' ), ), ], ])); $users = $dbm->database('default')->table('users'); // create or update table schema $schema = $users->getSchema(); $schema->primary('id'); $schema->string('name'); $schema->datetime('created_at'); $schema->datetime('updated_at'); $schema->save(); // insert data $users->insertOne([ 'name' => 'test', 'created_at' => new DateTimeImmutable(), 'updated_at' => new DateTimeImmutable(), ]); // select data foreach ($users->select()->where(['name' => 'test']) as $u) { print_r($u); }