Download the PHP package rmp-up/wp-di without Composer
On this page you can find all versions of the php package rmp-up/wp-di. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package wp-di
Short Description Simple Dependency Injection / Service Container for more OOP in WordPress (PSR-11 compatible)
License proprietary
Informations about the package wp-di
WP DI
PHP Dependency Injection for WordPress (based on Pimple)
This is nothing new but we added some magic:
- Compatible with projects using Pimple already
- Configuration via plain arrays, Yaml or other
- "Less WordPress more OOP"
and still searching for other magic to apply.
Getting started
Add the package to your project
and set up the container provider
Friends of YAML can add composer require symfony/yaml
and use
Features
A full documentation can be found in the documentation of the latest releases. The following is just a sneak peek into some of the possibilities. Try using the "preload.php" when you have PHP >= 7.4 or a composer workflow to get even more performance:
Services and parameters
Define services as known from classical DI but also ...
- Primitive parameters as usual
- Default values for options
- Path to templates
- Inject all of them into services
- Allow factories to create services
Register services in WordPress
Services can also be used to ...
- Add actions / filters
- Add Meta-Boxes
- Register Post-Types
- Register Shortcodes
- Register Widgets
- Add WP-CLI commands
Use tags to enhance YAML
Within YAML you can:
- Access PHP-Constants
- Concatenate text
- Translate text
Mostly lazy to get the best performance.
All of this is only possible when using \RmpUp\WpDi\Yaml::parseFile(...)
or ::parse(...)
.
Contributing
We used this in some projects and still maintain/enhance it, so please open an issue if there is anything we can help with.
If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.
Related projects
Please also note the following projects about dependency injection container in WordPress:
Licensing
See the LICENSE.txt for details.