{"id":18243763,"url":"https://github.com/elusivecodes/fyrecontainer","last_synced_at":"2025-04-11T15:43:03.396Z","repository":{"id":260630315,"uuid":"881905415","full_name":"elusivecodes/FyreContainer","owner":"elusivecodes","description":"FyreContainer is a free, open-source container library for PHP.","archived":false,"fork":false,"pushed_at":"2025-04-02T11:38:34.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T12:32:42.273Z","etag":null,"topics":["container","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/elusivecodes.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-11-01T13:27:14.000Z","updated_at":"2025-04-02T11:38:08.000Z","dependencies_parsed_at":"2024-12-10T09:29:36.680Z","dependency_job_id":"5eeba6f2-f865-437e-9d2d-52a1c0980902","html_url":"https://github.com/elusivecodes/FyreContainer","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"d84e485930b6782fb20300a4ab87a404280f2114"},"previous_names":["elusivecodes/fyrecontainer"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreContainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreContainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreContainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreContainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elusivecodes","download_url":"https://codeload.github.com/elusivecodes/FyreContainer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248433373,"owners_count":21102575,"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":["container","php"],"created_at":"2024-11-05T09:03:00.514Z","updated_at":"2025-04-11T15:43:03.388Z","avatar_url":"https://github.com/elusivecodes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FyreContainer\r\n\r\n**FyreContainer** is a free, open-source container library for *PHP*.\r\n\r\n\r\n## Table Of Contents\r\n- [Installation](#installation)\r\n- [Basic Usage](#basic-usage)\r\n- [Methods](#methods)\r\n- [Static Methods](#static-methods)\r\n\r\n\r\n\r\n## Installation\r\n\r\n**Using Composer**\r\n\r\n```\r\ncomposer require fyre/container\r\n```\r\n\r\nIn PHP:\r\n\r\n```php\r\nuse Fyre\\Container\\Container;\r\n```\r\n\r\n\r\n## Basic Usage\r\n\r\n- `$bind` is a boolean indicating whether to bind the container instance to itself, and will default to *true*.\r\n\r\n```php\r\n$container = new Container($bind);\r\n```\r\n\r\n\r\n## Methods\r\n\r\n**Bind**\r\n\r\nBind an alias to a factory *Closure* or class name.\r\n\r\n- `$alias` is a string representing the alias.\r\n- `$factory` is a string representing the class name, or a *Closure* that returns an instance of the class, and will default to the `$alias`.\r\n\r\n```php\r\n$container-\u003ebind($alias, $factory);\r\n```\r\n\r\n**Bind Attribute**\r\n\r\nBind a contextual attribute to a handler.\r\n\r\n- `$attribute` is a string representing the attribute.\r\n- `$handler` is a *Closure* that will resolve a value from the attribute.\r\n\r\n```php\r\n$container-\u003ebindAttribute($attribute, $handler);\r\n```\r\n\r\n**Build**\r\n\r\nBuild a class name, injecting dependencies as required.\r\n\r\n- `$className` is a string representing the class name.\r\n- `$arguments` is an array containing the named arguments for the class constructor.\r\n\r\n```php\r\n$instance = $container-\u003ebuild($className, $arguments);\r\n```\r\n\r\n**Call**\r\n\r\nExecute a callable using resolved dependencies.\r\n\r\n- `$callable` is an array, string or object representing the callable.\r\n- `$arguments` is an array containing the named arguments for the callabck.\r\n\r\n```php\r\n$result = $container-\u003ecall($callable, $arguments);\r\n```\r\n\r\n**Clear Scoped**\r\n\r\nClear the scoped instances, including any dependents.\r\n\r\n```php\r\n$container-\u003eclearScoped();\r\n```\r\n\r\n**Instance**\r\n\r\nBind an alias to a class instance.\r\n\r\n- `$alias` is a string representing the alias.\r\n- `$instance` is an object representing the class instance.\r\n\r\n```php\r\n$instance = $container-\u003einstance($alias, $instance);\r\n```\r\n\r\n**Scoped**\r\n\r\nBind an alias to a factory *Closure* or class name as a reusable scoped instance.\r\n\r\n- `$alias` is a string representing the alias.\r\n- `$factory` is a string representing the class name, or a *Closure* that returns an instance of the class, and will default to the `$alias`.\r\n\r\n```php\r\n$container-\u003escoped($alias, $factory);\r\n```\r\n\r\n**Singleton**\r\n\r\nBind an alias to a factory *Closure* or class name as a reusable instance.\r\n\r\n- `$alias` is a string representing the alias.\r\n- `$factory` is a string representing the class name, or a *Closure* that returns an instance of the class, and will default to the `$alias`.\r\n\r\n```php\r\n$container-\u003esingleton($alias, $factory);\r\n```\r\n\r\n**Unscoped**\r\n\r\nRemove an alias from the scoped instances.\r\n\r\n- `$alias` is a string representing the alias.\r\n\r\n```php\r\n$container-\u003eunscoped($alias);\r\n```\r\n\r\n**Unset**\r\n\r\nRemove an instance and optionally any dependents.\r\n\r\n- `$alias` is a string representing the alias.\r\n- `$unsetDepentents` is a boolean indicating whether to unset dependents, and will default to *false*.\r\n\r\n```php\r\n$container-\u003eunset($alias, $unsetDependents);\r\n```\r\n\r\n**Use**\r\n\r\nUse an instance of a class.\r\n\r\n- `$alias` is a string representing the alias.\r\n- `$arguments` is an array containing the named arguments for the class constructor.\r\n\r\n```php\r\n$instance = $container-\u003euse($alias, $arguments);\r\n```\r\n\r\n\r\n## Static Methods\r\n\r\n**Get Instance**\r\n\r\nGet the global instance.\r\n\r\n```php\r\n$container = Container::getInstance();\r\n```\r\n\r\n**Set Instance**\r\n\r\nSet the global instance.\r\n\r\n- `$container` is a *Container*.\r\n\r\n```php\r\nContainer::setInstance($container);\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyrecontainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felusivecodes%2Ffyrecontainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyrecontainer/lists"}