Download the PHP package helsingborg-stad/wpservice without Composer
On this page you can find all versions of the php package helsingborg-stad/wpservice. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download helsingborg-stad/wpservice
More information about helsingborg-stad/wpservice
Files in helsingborg-stad/wpservice
Package wpservice
Short Description Simplifies WordPress integration by providing a centralized WpService that exposes global WordPress functions in a streamlined manner. Simplify your development workflow and enhance WordPress integration with ease.
License MIT
Informations about the package wpservice
WpService
Simplifies WordPress integration by providing a centralized WpService that exposes global WordPress functions in a streamlined manner. Simplify your development workflow and enhance WordPress integration with ease.
About WpService
Enable the use of global WordPress functions in plugins and themes where applying Interface Segregation. Different flavors of the WordPress Service can be utilized by applying available decorators.
Getting Started
Installation
-
Install the package via composer:
- Use the WpService in your plugin or theme:
Decorators
Text Domain Decorator
Applies default text domain to translation functions.
Using WpService in tests
To make it easier when testing code that depends on the WpService or parts of it, a FakeWpService implementation is available. This implementation is useful when you want to test your code without having to rely on the WordPress functions.
Example
Consider that you have the following class that utilizes a part of the WpService:
You can then use FakeWpService in your tests to fake the results of the WpService as well as veifyin the calls made to the WpService functions:
Passing return values to the FakeWpService
The FakeWpService constructor accepts an array of key-value pairs where the key is the name of the method and the value is the return value of the method.
Built With
- PHP
Tests
Run tests
Run composer test
in the terminal.
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License.