{"id":16314907,"url":"https://github.com/frostealth/php-container","last_synced_at":"2025-04-28T11:10:43.882Z","repository":{"id":20200575,"uuid":"23471942","full_name":"frostealth/php-container","owner":"frostealth","description":"Simple Dependency Injection Container","archived":false,"fork":false,"pushed_at":"2015-11-13T11:42:27.000Z","size":148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-25T07:22:37.886Z","etag":null,"topics":["dependency-injection","php-container"],"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/frostealth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-29T17:27:09.000Z","updated_at":"2017-12-17T22:59:46.000Z","dependencies_parsed_at":"2022-08-30T20:11:02.943Z","dependency_job_id":null,"html_url":"https://github.com/frostealth/php-container","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostealth%2Fphp-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostealth%2Fphp-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostealth%2Fphp-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostealth%2Fphp-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frostealth","download_url":"https://codeload.github.com/frostealth/php-container/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239161848,"owners_count":19592336,"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":["dependency-injection","php-container"],"created_at":"2024-10-10T21:55:33.770Z","updated_at":"2025-02-16T16:42:30.124Z","avatar_url":"https://github.com/frostealth.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Container\n\nSimple Dependency Injection Container.\n\n## Installation\n\nRun the [Composer](http://getcomposer.org/download/) command to install the latest stable version:\n\n```\ncomposer require frostealth/php-container @stable\n```\n\n## Usage\n\n```php\nuse frostealth\\Container\\Container;\n\n$container = new Container();\n\n// ...\n\n// injecting simple values\n$container-\u003eset('foo', 'bar'); // or $container-\u003efoo = 'bar';\n\n// get its value\n$value = $container-\u003eget('foo');  // or $value = $container-\u003efoo;\n\n// ...\n\n// resources \n$container-\u003eset('object', function ($container) {\n    return new MyObject($container-\u003efoo);\n});\n\n// get a new instance\n$object = $container-\u003eget('object');\n\n// ...\n\n// singleton resources\n$container-\u003esingleton('log', function ($container) {\n    return new MyLog($container-\u003eobject);\n});\n\n// get log resource\n$log = $container-\u003eget('log');\n```\n\n## Dependency Injection\n\n```php\nuse Interop\\Container\\ContainerInterface;\n\nclass MyClass\n{\n    /**\n     * @var ContainerInterface\n     */\n    protected $container;\n\n    /**\n     * @param ContainerInterface $container\n     */\n    public function __construct(ContainerInterface $container)\n    {\n        $this-\u003econtainer = $container;\n    }\n}\n```\n\n## License\n\nThe MIT License (MIT).\nSee [LICENSE.md](https://github.com/frostealth/php-container/blob/master/LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrostealth%2Fphp-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrostealth%2Fphp-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrostealth%2Fphp-container/lists"}