fg / cakephp-essence
A plugin to use the essence library in a CakePHP 2 project.
Installs: 36
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=5.3.0
- composer/installers: ~1.0
- fg/essence: dev-master
- fg/essence-interfaces: dev-master
This package is auto-updated.
Last update: 2022-02-01 12:25:33 UTC
README
A plugin to use the essence library within controllers.
Installation
Just use composer from the app folder of your CakePHP installation:
{ "minimum-stability": "dev", "require": { "fg/cakephp-essence": "dev-master" }, "config": { "vendor-dir": "Vendor" } }
The plugin will be installed into Plugins/
, thanks to composer's CakePHP installer, and the Essence library will be installed into Vendor/
.
You should then load the plugin in Config/bootstrap.php
:
CakePlugin::load([ 'Essence' => [ 'bootstrap' => true ] ]);
Component
class MyController extends AppController { public $components = [ 'Essence.Essence' ]; /** * All methods of the Essence class are available through the Essence component. * * @see https://github.com/felixgirault/essence/blob/master/lib/fg/Essence/Essence.php */ public function embed( $url ) { $this->set( 'media', $this->Essence->embed( $url )); } }
Behavior
class MyModel extends AppModel { public $actsAs = [ 'Essence.Embeddable' ]; }