GitHunt
JA

javanile/granular

WordPress extension framework based on object-oriented paradigm.

WP Granular

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

Languages

PHP100.0%

Contributors

MIT License
Created May 14, 2018
Updated November 8, 2022
javanile/granular | GitHunt