https://github.com/javanile/granular
WordPress extension framework based on object-oriented paradigm.
https://github.com/javanile/granular
composer object-oriented-programming psr-4 testability wordpress wordpress-plugin
Last synced: 3 months ago
JSON representation
WordPress extension framework based on object-oriented paradigm.
- Host: GitHub
- URL: https://github.com/javanile/granular
- Owner: javanile
- License: mit
- Created: 2018-05-14T12:11:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-24T07:46:59.000Z (about 5 years ago)
- Last Synced: 2025-04-12T21:52:00.641Z (3 months ago)
- Topics: composer, object-oriented-programming, psr-4, testability, wordpress, wordpress-plugin
- Language: PHP
- Homepage:
- Size: 36.1 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WP Granular
[](https://github.styleci.io/repos/133355435)
[](https://travis-ci.org/javanile/granular)
[](https://codecov.io/gh/javanile/granular)
[](https://www.codacy.com/app/francescobianco/granular?utm_source=github.com&utm_medium=referral&utm_content=javanile/granular&utm_campaign=Badge_Grade)
[](https://opensource.org/licenses/MIT)WordPress extension framework based on object-oriented paradigm.
Using Granular you can write PSR compliant code increasing the general code quality
performing a better project organization. Organize your code in feature
or group WordPress actions and filters in the same scope.```php
namespace Acme\Plugin;use Javanile\Granular\Bindable;
class MyFirstPluginFeature extends Bindable
{
static $bindings = [
'action:init',
'filter:the_content' => 'theContent',
];public function init()
{
// Init code
}
public function theContent($content)
{
return $content;
}
}```
```php
use Javanile\Granular\Autoload;$app = new Autoload();
// add MyPlugin::init() method to WordPress init action
$app->register(MyPlugin::class, 'init');
```## Testing
```bash
$ docker-compose run --rm phpunit --stop-on-failure tests
```