{"id":37001706,"url":"https://github.com/artex-agency/di-container","last_synced_at":"2026-01-14T00:23:38.156Z","repository":{"id":272383401,"uuid":"916406587","full_name":"artex-agency/di-container","owner":"artex-agency","description":"A lightweight, PSR-11 compliant dependency injection and service container library with advanced features like tagged services, lifecycle hooks, and deferred services.","archived":false,"fork":false,"pushed_at":"2025-01-14T17:12:32.000Z","size":89,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-22T08:48:28.526Z","etag":null,"topics":["artex-software","dependency-injection","di-container","lifecycle-hooks","php","psr-11","service-container","tagged-services"],"latest_commit_sha":null,"homepage":"https://artexsoftware.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artex-agency.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-01-14T03:04:35.000Z","updated_at":"2025-01-19T20:28:05.000Z","dependencies_parsed_at":"2025-01-14T18:55:59.635Z","dependency_job_id":"2bcc15cc-5a4f-4afe-ad95-b2c44eda061e","html_url":"https://github.com/artex-agency/di-container","commit_stats":null,"previous_names":["artex-agency/servicecontainer","artex-agency/di-container"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/artex-agency/di-container","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artex-agency%2Fdi-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artex-agency%2Fdi-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artex-agency%2Fdi-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artex-agency%2Fdi-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artex-agency","download_url":"https://codeload.github.com/artex-agency/di-container/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artex-agency%2Fdi-container/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["artex-software","dependency-injection","di-container","lifecycle-hooks","php","psr-11","service-container","tagged-services"],"created_at":"2026-01-14T00:23:37.166Z","updated_at":"2026-01-14T00:23:38.137Z","avatar_url":"https://github.com/artex-agency.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\" id=\"top\"\u003e\n    \u003cpicture\u003e\n        \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"./docs/media/artex-agency-logo-dark.png\"\u003e\n        \u003cimg width=\"54\" alt=\"Artex Agency Logo\" src=\"./docs/media/artex-agency-logo.png\"\u003e\n    \u003c/picture\u003e    \n    \u003cbr\u003e\n    \u003cstrong\u003e\n        DI-CONTAINER\n        \u003cbr\u003e\n        \u003csmall\u003e\u003csup\u003eartex software\u003c/sup\u003e\u003c/small\u003e\n    \u003c/strong\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\u003cstrong\u003eA PSR-11 compliant dependency injection and service container library for modern PHP applications.\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://packagist.org/packages/artex/di-container\"\u003e\n        \u003cimg src=\"https://img.shields.io/packagist/v/artex/di-container\" alt=\"Latest Version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/artex/di-container\"\u003e\n        \u003cimg src=\"https://img.shields.io/packagist/dt/artex/di-container\" alt=\"Total Downloads\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/license-Apache%202.0-blue\" alt=\"License\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nArtex DI-Container is a lightweight, feature-rich library designed to simplify dependency management in PHP. Built with **high performance**, **flexibility**, and **extensibility** in mind, this library combines the power of dependency injection with a robust service container.\n\n## Key Features\n- **PSR-11 Compliant**: Adheres to the `ContainerInterface` standard for maximum interoperability.\n- **Dependency Injection**: Autowire classes and resolve dependencies effortlessly.\n- **Service Management**: Tagged services, lifecycle hooks, deferred loading, and more.\n- **Flexibility**: Perfect for frameworks, microservices, or standalone applications.\n\n---\n\n## Installation\n```sh\ncomposer \"require artex/di-container\"\n```\n\n\n## Usage\n\n### Basic Example\n\n```php\nuse Artex\\DIContainer\\ServiceContainer;\n\n$container = ServiceContainer::getInstance();\n\n// Register a shared service\n$container-\u003esingleton('logger', function () {\n    return new Logger();\n});\n\n// Resolve the service\n$logger = $container-\u003eget('logger');\n```\n\n\n### Tagged Services\n\n```php\n$container-\u003eset('handler1', new Handler1(), true, ['event']);\n$container-\u003eset('handler2', new Handler2(), true, ['event']);\n\n// Retrieve all services tagged with \"event\"\n$handlers = $container-\u003egetByTag('event');\n\n```\n\n### Lifecycle Hooks\n\n```php\n$container-\u003eonRegister(function ($id, $concrete, $shared) {\n    echo \"Service {$id} registered.\\n\";\n});\n\n$container-\u003eonResolve(function ($id, $instance) {\n    echo \"Service {$id} resolved.\\n\";\n});\n\n$container-\u003esingleton('db', function () {\n    return new DatabaseConnection();\n});\n\n```\n\n\u0026nbsp;\n## Testing\nRun tests using PHPUnit:\n```bash\n./vendor/bin/phpunit\n```\n\n\u0026nbsp;\n\n\n\n\u0026nbsp;\n\n## Credits\n\n- [James Gober](https://github.com/jamesgober) - Developer\n- [Artex Software](https://artexsoftware.com) - Sponsor\n\n\n\u0026nbsp;\n\n## License\nThe Apache License 2.0. Please see [LICENSE](LICENSE) file for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartex-agency%2Fdi-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartex-agency%2Fdi-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartex-agency%2Fdi-container/lists"}