{"id":26420422,"url":"https://github.com/ody-dev/database","last_synced_at":"2026-02-18T06:31:39.517Z","repository":{"id":279987928,"uuid":"940263353","full_name":"ody-dev/database","owner":"ody-dev","description":"Database components for ODY framework.","archived":false,"fork":false,"pushed_at":"2025-03-15T22:00:17.000Z","size":205,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T23:18:20.038Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ody-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-27T22:01:51.000Z","updated_at":"2025-03-15T22:21:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"a3ec59b8-10b0-4a02-b9d4-81b0926a5203","html_url":"https://github.com/ody-dev/database","commit_stats":null,"previous_names":["ody-dev/ody-database"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ody-dev%2Fdatabase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ody-dev%2Fdatabase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ody-dev%2Fdatabase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ody-dev%2Fdatabase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ody-dev","download_url":"https://codeload.github.com/ody-dev/database/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244141539,"owners_count":20404836,"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":[],"created_at":"2025-03-18T02:01:12.208Z","updated_at":"2026-02-18T06:31:39.511Z","avatar_url":"https://github.com/ody-dev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ODY database module\n\n⚠️ **IMPORTANT**: This repository is automatically generated from the [ody repo](https://github.com/ody-dev/ody) and is\nread-only.\n\nA high-performance database integration framework for PHP applications leveraging Swoole's coroutines.\n\n## Overview\n\nThe ODY Database module provides a connection pool implementation that works with popular PHP ORM solutions. It's\ndesigned to maximize performance in Swoole environments by efficiently managing database connections across coroutines.\n\n## Features\n\n- Connection pooling with Swoole coroutine awareness\n- Support for Doctrine ORM, and standalone DBAL\n- Automatic connection binding to coroutines\n- Built-in connection lifecycle management\n- Connection health checks and leak detection\n- Configurable pool size and connection settings\n\n## Installation\n\n```bash\ncomposer require ody/database\n```\n\n### Doctrine ORM\n\n```bash\ncomposer require doctrine/orm doctrine/dbal symfony/cache\n```\n\n### DBAL\n\n```bash\ncomposer require doctrine/dbal\n```\n\n## Basic Usage\n\n### Configuration\n\nDefine your database configuration:\n\n```php\n// config/database.php\nreturn [\n    'environments' =\u003e [\n        'local' =\u003e [\n            'driver' =\u003e 'mysql',\n            'host' =\u003e 'localhost',\n            'port' =\u003e 3306,\n            'database' =\u003e 'your_database',\n            'username' =\u003e 'your_username',\n            'password' =\u003e 'your_password',\n            'charset' =\u003e 'utf8mb4',\n        ],\n    ],\n    'connection_pool_enabled' =\u003e true,\n    'pool_size' =\u003e 10,\n];\n```\n\n### Using with Doctrine ORM\n\n```php\nuse Ody\\DB\\Doctrine\\Facades\\ORM;\nuse App\\Entities\\User;\n\n// Get entity manager\n$entityManager = ORM::entityManager();\n\n// Working with entities\n$user = $entityManager-\u003efind(User::class, 1);\n$entityManager-\u003epersist($user);\n$entityManager-\u003eflush();\n```\n\n### Using with Doctrine DBAL\n\n```php\nuse Ody\\DB\\Doctrine\\Facades\\DBAL;\n\n// Execute queries\n$users = $this-\u003econnection-\u003efetchAllAssociative('SELECT * FROM users WHERE active = ?', [1]);\n\n// Using query builder\n$queryBuilder = $this-\u003econnection-\u003ecreateQueryBuilder();\n$result = $queryBuilder\n    -\u003eselect('u.*')\n    -\u003efrom('users', 'u')\n    -\u003ewhere('u.active = :active')\n    -\u003esetParameter('active', 1)\n    -\u003eexecuteQuery()\n    -\u003efetchAllAssociative();\n```\n\n### Direct Connection Pool Access\n\n```php\nuse Ody\\DB\\ConnectionManager;\n\n// Initialize the pool\nConnectionManager::initPool($config);\n\n// Get a connection from the pool\n$connection = ConnectionManager::getConnection();\n\n// Use the PDO connection\n$stmt = $connection-\u003eprepare('SELECT * FROM users WHERE id = ?');\n$stmt-\u003eexecute([1]);\n$user = $stmt-\u003efetch(PDO::FETCH_ASSOC);\n\n// No need to return the connection - it's automatically returned when the coroutine ends\n```\n\n## Advanced Configuration\n\nThe connection pool can be finely tuned with options for:\n\n- Minimum idle connections\n- Idle timeout\n- Maximum connection lifetime\n- Borrowing timeout\n- Connection health checks\n- Leak detection threshold\n\nFor detailed documentation on advanced configuration and usage, refer to the full documentation.\n\n## Performance Benefits\n\n- Connections are reused across requests, eliminating the overhead of establishing new connections\n- Automatic binding to coroutines ensures connection safety in concurrent environments\n- Connection health checks prevent using broken connections\n- Leak detection helps identify and fix connection leaks\n- Configurable pool size matches your application needs and server resources\n\n## License\n\nThis package is licensed under the [MIT License](https://github.com/ody-dev/ody-foundation/blob/master/LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fody-dev%2Fdatabase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fody-dev%2Fdatabase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fody-dev%2Fdatabase/lists"}