All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Can now store primitive types and arrays without the need of a Closure
- Ability to access array elements via dot notation
- Feature to hook into get/set of the container and ability to manipulate your data or setup anything via callback
- Can hook into all get/set calls
- Can hook into specific keys
- Ability to use
count
on any Pouch instance to see the count of stored items
- Ability to bind named items during mass-bind
- Compliance with PHAR files (Pouch works when bundled in a PHAR archive)
- The concept of items to store information within the container
- New
alias
method to create a reference to an existing key - Ability to autowire parameters only by name and no type-hint
- Example:
pouch()->bind('foo', function () { return 'foo' }, true);
and then in your constructor:public function __construct($foo) {}
would resolve to the string foo
- Example:
- New
item
method to fetch theItem
object - Factory items can be called with different arguments every time they are needed. More about this in the wiki
- Complete rehaul of the container storage with the
Item
object - Factories have been simplified and merged with the item concept
- Fetching the raw closure is now way simpler
- Extracted traits for the factory related methods and alias methods
- Requires PHP 7.1+ instead of PHP 7.0+
- Old Factory class, now included within the item logic
- The
get
method is now the main container fetching method instead of resolve. - The
resolve
method in now used to go one step further if necessary and callgetContent()
if we're dealing with an internal container.
- Ability to provide a fully qualified class path when registering a namespace and which will then be used to resolve the namespace off it.
- An invalid test case.
- Container elements will only be instantiated/loaded on request and not on every page load.
- Extending previously set container elements (
extend
method) removed. Might be reintroduced later again.
- Now allows for proper injecting of more nested dependencies without any interaction.
- Properly handle pouch dependencies (
\Pouch\Key
) resolving in nested cases.
- Container content extension: if at some later point in the application you need to change upon the previous content of a key, you can now do so by using the
extend
method. - Declaration of a bind as a factory: This allows the creation of different instances of an object on consecutive resolves of a key (default behavior always pulls the same instance).
- Removed
__callStatic
which was meant to add the option to call all Pouch methods statically for syntactic sugar or personal preference. Now it's either thepouch()
helper or a completely new Pouch instance. - Cache handling moved to a
Cacheable
trait whichPouch
now uses. - Can now fully work with new instances of Pouch instead of relying on the
pouch()
helper.
- Resolvables now accept an argument which holds a container, allowing for a swap to a different instance other than the global
pouch()
one.
- Magic methods:
__get
,__isset
and__unset
to manage container keys - ACPu caching for expensive operations
- Ability to switch the cache driver by providing a PSR-16 compatible caching package during bootstrap
- New helper to deal with the cache (
pouchCache
)
- Lots of method docblocks
- PSR-11 compliance
- Can use the
pouch()
helper function in addition to calling methods statically. - Ability to reference a dependency stored within the container which might not be an actual class with
\Pouch\~Key~
- Wiki pages and API documentation
- Exceptions narrowed down and switched to comply to PSR-11 as well.
- Ability to override any class stored in the container when using
registerNamespaces()
- Constructor arguments get the automatic injection benefits
- Inability to have more than one dependency injected through a parameter
- Functionality to store data in an IoC container
- Ability to retrieve data from the container
- Register a namespace recursively for own application
- Ability to use typehints to fetch new instances of any data within your app, including dependencies
- Inability to have more than one dependency injected through a parameter