{"id":13616255,"url":"https://github.com/cycle/database","last_synced_at":"2025-05-16T09:06:37.368Z","repository":{"id":37008666,"uuid":"390670091","full_name":"cycle/database","owner":"cycle","description":"Database Abstraction Layer, Schema Introspection, Schema Generation, Query Builders","archived":false,"fork":false,"pushed_at":"2025-03-27T15:50:08.000Z","size":3696,"stargazers_count":55,"open_issues_count":29,"forks_count":26,"subscribers_count":4,"default_branch":"2.x","last_synced_at":"2025-04-09T06:04:03.088Z","etag":null,"topics":["database","hacktoberfest","mssql","mysql","php","postrgesql","sqlite"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cycle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"cycle"}},"created_at":"2021-07-29T09:24:50.000Z","updated_at":"2025-03-27T15:50:03.000Z","dependencies_parsed_at":"2023-02-17T05:46:04.229Z","dependency_job_id":"5994d01a-0e0d-400c-b05c-f88f48470192","html_url":"https://github.com/cycle/database","commit_stats":{"total_commits":527,"total_committers":26,"mean_commits":20.26923076923077,"dds":"0.29032258064516125","last_synced_commit":"cf6109a7e71509ef190a7393c74603f67054d87f"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fdatabase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fdatabase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fdatabase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fdatabase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cycle","download_url":"https://codeload.github.com/cycle/database/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254501558,"owners_count":22081528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","hacktoberfest","mssql","mysql","php","postrgesql","sqlite"],"created_at":"2024-08-01T20:01:25.917Z","updated_at":"2025-05-16T09:06:32.324Z","avatar_url":"https://github.com/cycle.png","language":"PHP","readme":"# Cycle DBAL\n\n[![Latest Stable Version](https://poser.pugx.org/cycle/database/v/stable)](https://packagist.org/packages/cycle/database)\n[![Build Status](https://github.com/cycle/database/workflows/build/badge.svg)](https://github.com/cycle/database/actions)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cycle/database/badges/quality-score.png?b=2.x)](https://scrutinizer-ci.com/g/cycle/database/?branch=2.x)\n[![Codecov](https://codecov.io/gh/cycle/database/branch/2.x/graph/badge.svg)](https://codecov.io/gh/cycle/database/)\n\nSecure, multiple SQL dialects (MySQL, PostgreSQL, SQLite, SQLServer), schema introspection, schema declaration, smart\nidentifier wrappers, database partitions, query builders, nested queries.\n\n## Documentation\n\n* [Installation and Configuration](https://cycle-orm.dev/docs/database-configuration)\n* [Access Database](https://cycle-orm.dev/docs/database-access)\n* [Database Isolation](https://cycle-orm.dev/docs/database-isolation)\n* [Query Builders](https://cycle-orm.dev/docs/database-query-builders)\n* [Transactions](https://cycle-orm.dev/docs/database-transactions)\n* [Schema Introspection](https://cycle-orm.dev/docs/database-introspection)\n* [Schema Declaration](https://cycle-orm.dev/docs/database-declaration)\n* [Migrations](https://cycle-orm.dev/docs/database-migrations)\n* [Errata](https://cycle-orm.dev/docs/database-errata)\n\n## Requirements\n\nMake sure that your server is configured with following PHP version and extensions:\n\n* PHP 8.0+\n* PDO Extension with desired database drivers\n\n## Installation\n\nTo install the component:\n\n```bash\ncomposer require cycle/database\n```\n\n## Example\n\nGiven example demonstrates the connection to SQLite database, creation of table schema, data insertion and selection:\n\n```php\n\u003c?php\ndeclare(strict_types=1);\n\nrequire_once \"vendor/autoload.php\";\n\nuse Cycle\\Database\\Config;\nuse Cycle\\Database\\DatabaseManager;\n\n$dbm = new DatabaseManager(new Config\\DatabaseConfig([\n    'databases'   =\u003e [\n        'default' =\u003e ['connection' =\u003e 'sqlite'],\n    ],\n    'connections' =\u003e [\n        'sqlite' =\u003e new Config\\SQLiteDriverConfig(\n            connection: new Config\\SQLite\\FileConnectionConfig(\n                database: 'runtime/database.db'\n            ),\n        ),\n    ],\n]));\n\n$users = $dbm-\u003edatabase('default')-\u003etable('users');\n\n// create or update table schema\n$schema = $users-\u003egetSchema();\n$schema-\u003eprimary('id');\n$schema-\u003estring('name');\n$schema-\u003edatetime('created_at');\n$schema-\u003edatetime('updated_at');\n$schema-\u003esave();\n\n// insert data\n$users-\u003einsertOne([\n    'name'       =\u003e 'test',\n    'created_at' =\u003e new DateTimeImmutable(),\n    'updated_at' =\u003e new DateTimeImmutable(),  \n]);\n\n// select data\nforeach ($users-\u003eselect()-\u003ewhere(['name' =\u003e 'test']) as $u) {\n    print_r($u);\n}\n```\n\n## License:\n\nMIT License (MIT). Please see [`LICENSE`](./LICENSE.md) for more information. Maintained\nby [Spiral Scout](https://spiralscout.com).\n","funding_links":["https://github.com/sponsors/cycle"],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle%2Fdatabase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycle%2Fdatabase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle%2Fdatabase/lists"}