Download the PHP package pedhot-dev/nepotismfree-di-autowire without Composer
On this page you can find all versions of the php package pedhot-dev/nepotismfree-di-autowire. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download pedhot-dev/nepotismfree-di-autowire
More information about pedhot-dev/nepotismfree-di-autowire
Files in pedhot-dev/nepotismfree-di-autowire
Download pedhot-dev/nepotismfree-di-autowire
More information about pedhot-dev/nepotismfree-di-autowire
Files in pedhot-dev/nepotismfree-di-autowire
Vendor pedhot-dev
Package nepotismfree-di-autowire
Short Description An optional Autowire / Resolver layer for NepotismFree-DI. Strict DI stays strict; this resolver sits on top.
License MIT
Package nepotismfree-di-autowire
Short Description An optional Autowire / Resolver layer for NepotismFree-DI. Strict DI stays strict; this resolver sits on top.
License MIT
Please rate this library. Is it a good library?
Informations about the package nepotismfree-di-autowire
NepotismFree Autowire
NepotismFree Autowire is an optional reflection-based resolution layer for the strict NepotismFree-DI container.
It allows you to resolve concrete classes and inject dependencies automatically using attributes, without compromising the strict, nepotism-free philosophy of the core container.
Philosophy
- Strict DI Stays Strict: This library does not modify the core container. The container remains immutable, explicit, and dumb (in a good way).
- Autowire is NOT a Container: It is a resolver. It uses the container to fetch defined services but instantiates undefined concrete classes on the fly.
- Opt-In Complexity: Reflection is only used when you explicitly ask for it via the Autowire facade.
Installation
Basic Usage
Wrap your strict container with the Autowire resolver.
Attributes
You can control injection logic using PHP Attributes.
| Attribute | Description | Example |
|---|---|---|
#[FromContainer] |
Inject a specific service ID from the strict container. | #[FromContainer('db.read')] |
#[FromEnv] |
Inject a value from environment variables. | #[FromEnv('API_KEY')] |
#[FromValue] |
Inject a raw/scalar value directly. | #[FromValue(100)] |
Architecture: Facade vs. Resolver
We separate Login from Ergonomics.
AutowireResolver: The brain. Contains all reflection logic, attribute parsing, and recursion.Autowire: The face. A simple facade that forwards calls to the resolver.
You will almost always use the Autowire facade in your application.
What this library does NOT do
- It does NOT auto-register services.
- Resolved instances are not stored back into the container.
- If you resolve
MyServicetwice, you get two new instances (unless it's explicitly bound as a singleton in the underlying container).
- It does NOT implement
ContainerInterface.- It is a tool for resolving, not for storing.
- It does NOT support "magic" binding.
- There is no
bind()method on the Autowire layer. Bindings belong in the strict container. Autowire just reads them.
- There is no
When to use?
- Use Strict Container for: Core infrastructure, specific implementations of interfaces, singletons, and reusable services.
- Use Autowire for: Controllers, Jobs, Commands, and "leaf" nodes of your application that have many dependencies but don't need to be shared.
All versions of nepotismfree-di-autowire with dependencies
PHP Build Version
Package Version
The package pedhot-dev/nepotismfree-di-autowire contains the following files
Loading the files please wait ...