{"id":15296161,"url":"https://github.com/commonphp/drivers","last_synced_at":"2026-01-05T09:07:23.009Z","repository":{"id":223009787,"uuid":"758792402","full_name":"commonphp/drivers","owner":"commonphp","description":"Provides a robust framework for managing driver implementations in PHP applications. By leveraging attributes and contracts, it offers a flexible system to register, enable, and utilize various drivers seamlessly within your projects.","archived":false,"fork":false,"pushed_at":"2024-02-17T17:30:57.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-30T05:26:31.333Z","etag":null,"topics":["commonphp","driver-management","modular","modular-architecture","open-source","php"],"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/commonphp.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":"2024-02-17T05:01:46.000Z","updated_at":"2024-03-11T16:34:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"fcaddee4-e741-440f-90cd-69fd34dda645","html_url":"https://github.com/commonphp/drivers","commit_stats":null,"previous_names":["commonphp/drivers"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fdrivers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fdrivers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fdrivers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fdrivers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commonphp","download_url":"https://codeload.github.com/commonphp/drivers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245407755,"owners_count":20610232,"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":["commonphp","driver-management","modular","modular-architecture","open-source","php"],"created_at":"2024-09-30T18:09:36.870Z","updated_at":"2026-01-05T09:07:23.003Z","avatar_url":"https://github.com/commonphp.png","language":"PHP","readme":"# CommonPHP Driver Management Library\n\nThe CommonPHP Driver Management Library provides a robust framework for managing driver implementations in PHP applications. By leveraging attributes and contracts, it offers a flexible system to register, enable, and utilize various drivers seamlessly within your projects.\n\n## Features\n\n- **Flexible Driver Configuration**: Configure drivers using PHP 8 Attributes or by specifying driver contracts.\n- **Dynamic Driver Support Checking**: Determine if a class is supported as a driver based on its configuration.\n- **Driver Instantiation**: On-demand driver instantiation managed by the CommonPHP Service Management framework, ensuring dependency injection and singleton management.\n- **Comprehensive Exception Handling**: Detailed exception handling for configuration errors, unsupported drivers, and instantiation issues.\n\n## Installation\n\nUse Composer to integrate the Driver Management Library into your project:\n\n```bash\ncomposer require comphp/drivers\n```\n\n## Configuration\n\n### Define Driver Contracts or Attributes\n\nImplement `DriverContract` for interface/abstract class-based drivers or use `DriverAttributeContract` to mark drivers with attributes.\n\n### Register and Configure DriverManager\n\n```php\nuse CommonPHP\\Drivers\\DriverManager;\nuse CommonPHP\\Drivers\\ServiceProviders\\DriverManagerServiceProvider;\nuse CommonPHP\\ServiceManagement\\ServiceManager;\n\n// Initialize ServiceManager and register DriverManagerServiceProvider\n$serviceManager = new ServiceManager();\n$serviceManager-\u003eproviders-\u003eregisterProvider(DriverManagerServiceProvider::class);\n\n// Retrieve an instance of DriverManager\n$driverManager = $serviceManager-\u003eget(DriverManager::class);\n\n// Configure DriverManager with an attribute or contract class\n$driverManager-\u003econfigure(\n    attributeClass: YourDriverAttribute::class,\n    contractClass: YourDriverContract::class\n);\n```\n\n## Usage\n\n### Enable a Driver\n\nOnce a driver meets the configured criteria (attribute or contract), enable it using:\n\n```php\n$driverManager-\u003eenable(YourDriverClass::class);\n```\n\n### Utilize an Enabled Driver\n\nRetrieve and use an enabled driver:\n\n```php\n$driver = $driverManager-\u003eget(YourDriverClass::class);\n$driver-\u003eperformAction();\n```\n\n## Contributing\n\nContributions to the CommonPHP Driver Management Library are welcome. Please follow the contribution guidelines provided in the repository for submitting pull requests or issues.\n\n## License\n\nThis library is released under the MIT license. See [LICENSE](LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonphp%2Fdrivers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommonphp%2Fdrivers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonphp%2Fdrivers/lists"}