Download the PHP package dhii/wp-containers without Composer
On this page you can find all versions of the php package dhii/wp-containers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dhii/wp-containers
More information about dhii/wp-containers
Files in dhii/wp-containers
Package wp-containers
Short Description PSR-11 container implementations that wrap some WP features, for convenience and interoperability.
License MIT
Informations about the package wp-containers
[Archived] Dhii - WP Containers
Please check Packagist for alternatives
Details
PSR-11 container implementations that wrap some WP features, for convenience and interoperability.
Features
Retrieve sites by key
Retrieve site options by key
Retrieve site meta by key
Structured error handling
This solves the problem of inconsistent behaviour of native WordPress option-related funtions:
- retrieved options returned
false
for both afalse
value and when not found, making them hard to distinguish; - setting an option returned
false
for both failure, an when the value is the same as the curent value, often resulting in a false error.
This is no longer the case with the above containers: option operations succeed or correctly fail by throwing PSR-11 exceptions. Furthermore, the original behaviour of these exceptions has been extended to allow retrieval of the key that was not found (when applicable) and the container that failed the operation. This is optional, however, and depending simply on the PSR-11 exceptions will work as expected.
The set()
, has()
, and delete()
also throw ContainerExceptionInterface
on failure.
Wraps WP
The containers do not re-create the functionality to go around WordPress. Instead, they wrap native WordPress functionality,
so you can be sure that everything is done in the same way, all the hooks, such as option_*
or pre_update_option_*
, still work.
All versions of wp-containers with dependencies
psr/container Version ^1.0
dhii/data-container-interface Version ^0.2.1-alpha1