https://github.com/phpgt/servicecontainer
Centralised container of a project's core objects.
https://github.com/phpgt/servicecontainer
autowiring dependency-injection dependency-injection-container maintainability service-container testability
Last synced: about 1 year ago
JSON representation
Centralised container of a project's core objects.
- Host: GitHub
- URL: https://github.com/phpgt/servicecontainer
- Owner: phpgt
- License: mit
- Created: 2021-05-21T16:13:36.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-12T16:12:26.000Z (about 2 years ago)
- Last Synced: 2025-03-07T12:08:36.914Z (about 1 year ago)
- Topics: autowiring, dependency-injection, dependency-injection-container, maintainability, service-container, testability
- Language: PHP
- Homepage: https://www.php.gt/servicecontainer
- Size: 96.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Centralised container of a project's core objects.
==================================================
When PHP applications have a lot of classes, it's important to use [dependency injection][dependency-injection] techniques to keep your code maintainable and testable; rather than constructing objects within the functions they are used, pass the objects into the function via parameters.
Within this repository, a `Container` is an object that can be assigned pre-constructed instances of objects, and an `Injector` is an object that can automatically invoke other objects' methods with the matching instances from the Container.
There are no rules to how this repository should be used. You may want to have a single Container accessible to a single layer of your code, or you may want to have multiple Containers within your application to provide a different pool of object instances to different areas of your code.
This repository is used within [WebEngine][webengine] to automatically invoke Page Logic functions, allowing the developer to have a single point within the application that is responsible for the object access of all first and third party classes.
***
[dependency-injection]: https://martinfowler.com/articles/injection.html
[webengine]: https://www.php.gt/webengine