javanile/granular

There is no license information available for the latest version (0.0.11) of this package.

0.0.11 2020-04-24 07:46 UTC

This package is auto-updated.

Last update: 2024-10-24 17:22:54 UTC


README

StyleCI Build Status codecov Codacy Badge License: 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.

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');

Testing

$ docker-compose run --rm phpunit --stop-on-failure tests