Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 19 days 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 (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-24T07:46:59.000Z (over 4 years ago)
- Last Synced: 2024-04-05T12:02:11.382Z (9 months ago)
- Topics: composer, object-oriented-programming, psr-4, testability, wordpress, wordpress-plugin
- Language: PHP
- Homepage:
- Size: 36.1 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WP Granular
[![StyleCI](https://github.styleci.io/repos/133355435/shield?branch=master)](https://github.styleci.io/repos/133355435)
[![Build Status](https://travis-ci.org/javanile/granular.svg?branch=master)](https://travis-ci.org/javanile/granular)
[![codecov](https://codecov.io/gh/javanile/granular/branch/master/graph/badge.svg)](https://codecov.io/gh/javanile/granular)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d37299ab3e874e94b758ffe11438ac7f)](https://www.codacy.com/app/francescobianco/granular?utm_source=github.com&utm_medium=referral&utm_content=javanile/granular&utm_campaign=Badge_Grade)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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
```