Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Yii Extension for Zumba Swivel
This plugin provides the necessary elements for using Swivel in a Yii 1.1+ Application.
This plugin is based on the zumba/swivel-cake plugin.
This package is available for installation via composer:
composer require "dhluther/yii-swivel":"~1"
Configuration for Yii Component:
By default, the component is assumed to be under the /protected/vendors/ directory, if your composer.json is under the protected folder. If you need to change that location, simply update the extensionAlias in the configuration array.
'swivel' => [ 'class'=>'SwivelComponent' ],
'swivel' => [ 'class'=>'SwivelComponent', 'extensionAlias'=>'application.extensions.swivel', ],
Access from the application
// If the user has the feature behavior bucket enabled, use the testFeature.New.Something behavior, // else use the default Yii::app()->swivel->forFeature( 'testFeature' ) ->addBehavior('New.Something', [$this,'doSomethingB'], $args) ->defaultBehavior([$this, 'doSomethingA'], $args ) ->execute(); // If the user has the feature behavior bucket enabled, use the first callable, // else use the second callable (default) Yii::app()->swivel->invoke('testFeature.New.Something', [$this,'doSomethingB'],[$this, 'doSomethingA']);
Make sure that your bootstrap file is set to properly include the composer autoloader. This extension assumes that your vendor directory is under the protected folder, so if that is not the case, please make sure you adjust the paths accordingly in the require and configuration options.
In the index.php bootstrap:
require(__DIR__ . '/protected/vendor/autoload.php');