Download the PHP package evista/compress without Composer
On this page you can find all versions of the php package evista/compress. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download evista/compress
More information about evista/compress
Files in evista/compress
Package compress
Short Description Composer package manager integration for WordPress
License MIT
Informations about the package compress
ComPress
ComPress is a Wordpress plugin that helps to use composer with a lazy loader service container (dependency injector).
Install
Usage
Documentation
ComPress plugin makes the marvellous Composer accessible in any WordPress project. If you never heard about it, Composer is a PHP package manager with a very good dependency resolver that makes using of third party libraries a breeze.
Composer transformed the PHP ecosystem recently so you should probably learn it. If you want to use the latest Twig templating engine in your WordPress plugins or themes you only have to
- run composer require twig/twig in the module’s root dir
- add the new package to the lazy loader service container’s setup
Afterwards the Twig rendering engine will be accessible from anywhere this way:
How to add a package to the container
Every package has a different way of initializing, the container helps collect them under a unified API -- and besides it helps decoupling your code (decoupling makes your code more maintanable and solid)
Twig’s documentation says this is the way you can instantiates Twig after installing it:
So the container needs to instantiate two classes, the Twig_Loader_Filesystem and using it as an argument the Twig_Environment class, that can be used to rendering directly. The container can solve this dependency easily if we define two services, and use the first as an argument of the second:
The Composer::services variable holds all the needed informations. Every one of them requires a unique name, that will identify them throughout WordPress. These names will be the keys of the services array, and the most important properties of the services in an array are the values.
In the above example, ‘twig.templating’ is the name, this is how it can be requested from the container:
In the configuration array above there are two important key value pairs: class and arguments.
The first tells the container which class should it use to instantiate the service (with namespaces), and second tells what argument to use in what order. So far strings, flat (one level) arrays and other services are supported as argument.
And this is it. After modifying Composer you are ready to use your new package installed via composer.
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.