{"id":23353621,"url":"https://github.com/jd297/psr-container","last_synced_at":"2025-10-25T13:15:15.533Z","repository":{"id":221072928,"uuid":"753376153","full_name":"JD297/psr-container","owner":"JD297","description":"Simple implementation of PSR-11 (Container Interface)","archived":false,"fork":false,"pushed_at":"2024-08-07T17:09:11.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T19:19:50.667Z","etag":null,"topics":["container","dependency-injection","di","psr-11"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/jd297/psr-container","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JD297.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-06T01:49:01.000Z","updated_at":"2024-02-06T01:51:18.000Z","dependencies_parsed_at":"2024-02-06T02:41:03.487Z","dependency_job_id":"b74a7649-6533-4248-af53-642e5424034c","html_url":"https://github.com/JD297/psr-container","commit_stats":null,"previous_names":["jd297/psr-container"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/JD297/psr-container","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JD297%2Fpsr-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JD297%2Fpsr-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JD297%2Fpsr-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JD297%2Fpsr-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JD297","download_url":"https://codeload.github.com/JD297/psr-container/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JD297%2Fpsr-container/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018010,"owners_count":26086235,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["container","dependency-injection","di","psr-11"],"created_at":"2024-12-21T09:14:35.212Z","updated_at":"2025-10-14T05:40:27.485Z","avatar_url":"https://github.com/JD297.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# psr-container (PSR-11)\n\nSimple implementation of [PSR-11 (Container Interface)](https://www.php-fig.org/psr/psr-11/).\n\n## Requirements\n\nThe following versions of PHP are supported by this version.\n\n* PHP ^8.1\n\n## Usage\n\n```php\nuse Acme\\Service\\ExampleService;\nuse Jd297\\Psr\\Clock\\SystemClock;\nuse Jd297\\Psr\\Container\\Container;\nuse Jd297\\Psr\\Logger\\Handler\\FileHandler;\nuse Jd297\\Psr\\Logger\\Logger;\nuse Psr\\Clock\\ClockInterface;\nuse Psr\\Log\\LoggerInterface;\n\n$container = new Container();\n\n$container-\u003eadd('projectDir', fn () =\u003e __DIR__.'/..');\n\n$container-\u003eadd(ClockInterface::class, fn () =\u003e new SystemClock());\n\n$container-\u003eadd(LoggerInterface::class, function (Container $container) {\n    return new Logger(\n        $container-\u003eget(ClockInterface::class),\n        [\n            new FileHandler(sprintf('%s/var/log/dev.log', $container-\u003eget('projectDir')))\n        ]\n    );\n});\n\n/** @var ExampleService $exampleService */\n$exampleService = $container-\u003eadd(ExampleService::class)-\u003eget(ExampleService::class);\n$exampleService-\u003esetLogger($container-\u003eget(LoggerInterface::class)); // using the LoggerAwareTrait\n\n$exampleService-\u003eexecute();\n```\n\n## Composer\n\n### Scripts\n\nReformat code with [PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer).\n``` bash\n$ composer reformat\n```\n\nTest source code with [PHPUnit](https://github.com/sebastianbergmann/phpunit).\n``` bash\n$ composer unit\n```\n\nAnalyse files with [PHPStan](https://github.com/phpstan/phpstan) (Level 9).\n``` bash\n$ composer analyse\n```\n\n## License\n\nThe BSD 2-Clause \"Simplified\" License (BSD-2-Clause). Please see [License File](https://github.com/jd297/psr-container/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjd297%2Fpsr-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjd297%2Fpsr-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjd297%2Fpsr-container/lists"}