{"id":15296055,"url":"https://github.com/szado/php-resource-pool","last_synced_at":"2025-04-13T19:51:39.512Z","repository":{"id":42849070,"uuid":"434753668","full_name":"szado/php-resource-pool","owner":"szado","description":"A PHP library providing resource pooling support, commonly used as a database connection pool.","archived":false,"fork":false,"pushed_at":"2025-03-06T18:47:08.000Z","size":76,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T22:32:01.344Z","etag":null,"topics":["connection-manager","connection-pool","php","reactphp"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-12-03T22:48:24.000Z","updated_at":"2025-03-06T18:32:29.000Z","dependencies_parsed_at":"2024-10-15T01:20:32.620Z","dependency_job_id":null,"html_url":"https://github.com/szado/php-resource-pool","commit_stats":null,"previous_names":["szado/reactphp-connection-pool"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szado%2Fphp-resource-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szado%2Fphp-resource-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szado%2Fphp-resource-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szado%2Fphp-resource-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szado","download_url":"https://codeload.github.com/szado/php-resource-pool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248773815,"owners_count":21159519,"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":["connection-manager","connection-pool","php","reactphp"],"created_at":"2024-09-30T18:09:06.085Z","updated_at":"2025-04-13T19:51:39.492Z","avatar_url":"https://github.com/szado.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shado/php-resource-pool\n\nA PHP library providing resource pooling support, commonly used as a database connection pool.\n\nResource pooling allows you to easily manage a range of concurrently maintained resources. You can define how many of them can be created or which algorithm should be used for selecting the next resource from the pool.\n\nThe library includes two implementations of the pool:\n\n- `ResourcePool` – provides basic pooling logic, including borrowing and returning resources. \n- `AsyncResourcePool` – a [ReactPHP](https://reactphp.org/)-based implementation that adds resource retry functionality to the basic features.\n\n## Requirements\n\n- PHP \u003e= 8.1\n\n\u003e [!TIP]\n\u003e Thanks to Fibers, you can freely use the ReactPHP-based implementation in your traditional PHP projects.\n\n## Example\n\n```php\n$factory = function (\\Shado\\ResourcePool\\FactoryController $controller) {\n    $newConnection = new DbConnection();\n    $newConnection-\u003eonClose($controller-\u003edetach(...)); // When connection closes, detach it from the pool\n    return $newConnection;\n};\n\n$pool = new \\Shado\\ResourcePool\\ResourcePool($factory, 10);\n\n$connection = $pool-\u003eborrow(); // `$connection` is ready to use :)\n// $connection-\u003equery(...);\n$pool-\u003ereturn($connection);\n```\n\n## At the end...\n- Run tests: `./vendor/bin/phpunit tests`.\n- Feel free to create an issue or submit your PR! 🤗\n- Licence: MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszado%2Fphp-resource-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszado%2Fphp-resource-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszado%2Fphp-resource-pool/lists"}