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.
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;
}
}
use Javanile\Granular\Autoload;
$app = new Autoload();
// add MyPlugin::init() method to WordPress init action
$app->register(MyPlugin::class, 'init');
$ docker-compose run --rm phpunit --stop-on-failure tests