Installing the Plugin is pretty much as with every other CakePHP Plugin.
composer require dereuromark/cakephp-tools
Details @ https://packagist.org/packages/dereuromark/cakephp-tools
This will load the plugin (within your boostrap file):
Plugin::load('Tools');
or
Plugin::loadAll(...);
In case you want the Tools bootstrap file included (recommended), you can do that in your ROOT/config/bootstrap.php with
Plugin::load('Tools', ['bootstrap' => true]);
or
Plugin::loadAll([
'Tools' => ['bootstrap' => true]
]);
Using Cake3 and namespaces, don't forget to add "Tools" as namespace to new files.
Also don't forget the use statements.
If you create a new behavior in the plugin, it might look like this:
namespace Tools\Model\Behavior;
use Cake\ORM\Behavior;
class CoolBehavior extends Behavior {
}
For a new APP behavior "MySlugged" that extends "Tools.Slugged" it is:
namespace App\Model\Behavior;
use Tools\Model\Behavior\SluggedBehavior;
class MySluggedBehavior extends SluggedBehavior {
}
Note that use statements should be in alphabetical order. See CakePHP coding standards for details.
Internally (method access), you don't use the namespace declaration. The plugin name suffices:
// In a Table
$this->addBehavior('Tools.Slugged'); // Adding SluggedBehavior
// In a View
$this->loadHelper('Tools.Foo'); // Adding FooHelper
// In a Controller (deprecated)
public $helpers = ['Tools.Foo']; // Adding FooHelper
For Configure usage especially in view files, you can add this to the bootstrap:
class_alias('Cake\Core\Configure', 'Configure');
This avoids having to add tons of use statements at the top of your view ctps.
But using the helper is preferred and a bit cleaner ($this->loadHelper('Shim.Configure'));