{"id":23769965,"url":"https://github.com/morphable/simplecontainer","last_synced_at":"2025-09-11T11:48:07.684Z","repository":{"id":57019913,"uuid":"167418290","full_name":"Morphable/SimpleContainer","owner":"Morphable","description":null,"archived":false,"fork":false,"pushed_at":"2019-01-29T19:09:36.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-01T02:34:57.626Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Morphable.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}},"created_at":"2019-01-24T18:44:23.000Z","updated_at":"2019-02-26T06:53:40.000Z","dependencies_parsed_at":"2022-08-22T20:31:17.661Z","dependency_job_id":null,"html_url":"https://github.com/Morphable/SimpleContainer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morphable%2FSimpleContainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morphable%2FSimpleContainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morphable%2FSimpleContainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morphable%2FSimpleContainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Morphable","download_url":"https://codeload.github.com/Morphable/SimpleContainer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239952597,"owners_count":19723922,"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":[],"created_at":"2025-01-01T02:35:06.204Z","updated_at":"2025-02-21T03:41:19.441Z","avatar_url":"https://github.com/Morphable.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple container component\nA simple container component, easy to implement into any system\n\n## Installing\n```terminal\n$ composer require morphable/simple-container\n```\n\n## Usage\n```php\n\u003c?php\n\nuse \\Morphable\\SimpleContainer;\n\n$container = new SimpleContainer();\n$container-\u003eadd('item', new MyClass());\n$container-\u003eget('item');\n$container-\u003eexists('item');\n$container-\u003eupdate('item', 'something else');\n$container-\u003edelete('item');\n\n// if you don't know whether the item exists, every method except exists throws an exception\n\ntry {\n    $container-\u003eget('item that does not exists');\n} catch (\\Morphable\\SimpleContainer\\Exception\\InstanceNotFound $e) {\n    // handle exception\n}\n\ntry {\n    $container-\u003eadd('item that exists', '...');\n} catch (\\Morphable\\SimpleContainer\\Exception\\InstanceAlreadyExists $e) {\n    // handle exception\n}\n\n```\nExecutable container\n```php\n\u003c?php\n\nuse \\Morphable\\SimpleContainer\\ExecutableContainer;\n\n$container = new ExecutableContainer(\"required_method\");\n\n// needs method required_method\n$class = new MyClass();\n\n$container-\u003eadd('item', $class);\n\n// executes all items in container\n$container-\u003eexecute('any','parameter');\n\n```\n\n## Contributing\n- Follow PSR-2 and the .editorconfig\n- Start namespaces with \\Morphable\\SimpleContainer\n- Make tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorphable%2Fsimplecontainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorphable%2Fsimplecontainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorphable%2Fsimplecontainer/lists"}