dhii / data-container-interface
Interfaces for working with data containers
Installs: 19 147
Dependents: 16
Suggesters: 1
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^5.3 | ^7.0
- dhii/exception-interface: ^0.1 | ^0.2
- dhii/factory-interface: ^0.1-alpha1
- psr/container: ^1.0
Requires (Dev)
- codeclimate/php-test-reporter: <=0.3.2
- dhii/php-cs-fixer-config: dev-php-5.3
- dhii/stringable-interface: ^0.1
- phpunit/phpunit: ^4.8
- ptrofimov/xpmock: ^1.1
Suggests
- dhii/stringable-interface: To be able to pass Stringables as keys
This package is auto-updated.
Last update: 2020-03-11 15:05:36 UTC
README
Interfaces for working with data containers.
Details
This package introduces a couple of completely new interfaces for granularity, and extends the exceptions interfaces to make them more useful, while still sticking to the spirit of PSR-11.
Interfaces in this package extend those from psr/container
, the PSR-11
repository, where applicable. As such, the container itself, as well as the
exceptions, are compatible with PSR-11, in the sense that it's possible to pass
instances of the respective interfaces from this package where PSR-11 interfaces
are expected.
At the same time, the interfaces of this package aim to be compatible with those of PSR-16. This means that theoretically, implementations of these interfaces should be usable as a cache storage - albeit, in the current state of PSR-16, with some adaptation. In theory, this should allow all data objects to be accessible in the same way, regardless of what they are used for.
This package also supports dhii/stringable-interface
: anything that expects
or returns a string key can also accept or return a StringableInterface
respectively, in addition to a string
. However, this is optional, and there
is no dependency on that package; implementations are responsible for requiring
dhii/stringable-interface
themselves.
📖 Please see Wiki for detailed explanation.
Interfaces
HasCapableInterface
- Allows checking for existence of data value by key.ContainerInterface
- Allows checking for and retrieval of data value by key.ContainerAwareInterface
- Allows retrieval of a container instance.SetCapableInterface
- Allows setting the value for a key.SetCapableContainerInterface
- A container that can have a value set for a key.DeleteCapableInterface
- Allows deleting a value by key.DeleteCapableContainerInterface
- A container that allows deleting a value by key.ClearCapableInterface
- Allows deleting all values.ClearCapableContainerInterface
- A container that allows deleting all values.ContainerFactoryInterface
- A factory that can create containers.ContainerExceptionInterface
- An exception that occurs in relation to a container, and is aware of that container.NotFoundExceptionInterface
- An exception that occurs when attempting to retrieve data for key that is not set, and is also container aware by extension.
Installation
composer require dhii/data-container-interface:^0.2