2017 © Pedro Peláez
 

cakephp-plugin cakephp-yo-plugin

Yo Plugin for CakePHP

image

nanexcool/cakephp-yo-plugin

Yo Plugin for CakePHP

  • Thursday, August 14, 2014
  • by nanexcool
  • Repository
  • 1 Watchers
  • 1 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Yo plugin for CakePHP

This CakePHP plugin features a simple component to send Yos from your controllers and a behavior that you can attach to your models., (*1)

Get your API Key at http://dev.justyo.co/, (*2)

Requirements

PHP >= 5.2 with CURL, (*3)

CakePHP 2 and up, (*4)

Usage

Copy Yo Folder to your app/Plugin directory., (*5)

Load plugin in app/Config/bootstrap.php, (*6)

CakePlugin::loadAll(); // Loads all plugins at once
CakePlugin::load('Yo'); //Loads a single plugin

Enter your API Key in Yo/Config/config.php, (*7)

Configure::write('Yo.apiKey', 'YOUR_API_KEY');

Using Yo in a controller

Add the Yo Component to a controller, or to AppController to use it in every controller., (*8)

Call $this->Yo->all() to send a YO to everyone, or $this->Yo->user('USERNAME') to send a YO to USERNAME., (*9)

Check the example below, (*10)

class UsersController extends AppController {

    // Add the component
    public $components = array('Yo.Yo');

    public function index() {
        // send a Yo to everyone
        $this->Yo->all();

        // send a Yo to user USERNAME
        $this->Yo->user('USERNAME');
    }

}

Using Yo in a model

If you want to get a Yo whenever a model is created, updated or deleted use the behavior included., (*11)

In the model you care about add $actsAs = array('Yo.Yo'). By default it will Yo only when a record is created. If you care about updates and deletes you'll need to modify the options., (*12)

By default the behavior sends a Yo using $this->Yo->all(). If you want to send to only one user, modify the setting when adding the behavior in $actsAs., (*13)

Check the example below, (*14)

class User extends AppModel {

    // These settings are defaults.
    public $actsAs = array(
        'Yo.Yo' => array(
            'afterSave' => true,
            'afterUpdate' => false,
            'afterDelete' => false,
            'username' => '' // set a username so it doesn't send to everyone
        )
    );
}

License

MIT, (*15)

The Versions

14/08 2014

dev-develop

dev-develop https://github.com/nanexcool/yo-plugin-cakephp

Yo Plugin for CakePHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

cakephp yo

24/07 2014

dev-master

9999999-dev https://github.com/nanexcool/yo-plugin-cakephp

Yo Plugin for CakePHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

cakephp yo

23/07 2014

v0.2.1

0.2.1.0 https://github.com/nanexcool/yo-plugin-cakephp

Yo Plugin for CakePHP

  Sources   Download

MIT

The Requires

  • php >=5

 

cakephp yo

23/07 2014

v0.2

0.2.0.0 https://github.com/nanexcool/yo-plugin-cakephp

Yo Plugin for CakePHP

  Sources   Download

MIT

The Requires

  • php >=5

 

cakephp yo