2017 © Pedro Peláez
 

yii-extension yii-extension

Tools for building extensions for the Yii PHP framework.

image

crisu83/yii-extension

Tools for building extensions for the Yii PHP framework.

  • Tuesday, February 11, 2014
  • by crisu83
  • Repository
  • 1 Watchers
  • 3 Stars
  • 2,807 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

yii-extension

Latest Stable Version, (*1)

A convenient way to start building your own extensions for the Yii PHP framework., (*2)

This project was created to minimize boilerplate code required when creating new extensions for Yii. It includes separate behaviors for Widgets, Components and Modules that all extend the ExtensionBehavior class., (*3)

Usage

Widgets

Attaching the behavior

Yii::import('vendor.crisu83.yii-extension.behaviors.*');

MyWidget extends CWidget
{
  public function init() 
  {
    parent::init();
    $this->attachBehavior('ext', new WidgetBehavior);
  }
}

Registering assets

$this->publishAssets(__DIR__ . '/path/to/assets');
$this->registerCssFile('css/styles.css');
$this->registerScriptFile('js/script.js');

Components

Attaching the behavior

Yii::import('vendor.crisu83.yii-extension.behaviors.*');

MyApplicationComponent extends CApplicationComponent
{
  public function init() 
  {
    parent::init();
    $this->attachBehavior('ext', new ComponentBehavior);
  }
}

Importing classes and directories

$this->createPathAlias('myExtension', __DIR__);
$this->import('MyClass');
$myClass = new MyClass;

Registering assets

$this->publishAssets(__DIR__ . '/path/to/assets');
$this->registerCssFile('css/styles.css');
$this->registerScriptFile('js/script.js');

Modules

Attaching the behavior

Yii::import('vendor.crisu83.yii-extension.behaviors.*');

MyModule extends CWebModule
{
  public function init() 
  {
    parent::init();
    $this->attachBehavior('ext', new ModuleBehavior);
  }
}

Importing classes and directories

$this->import('MyClass');
$myClass = new MyClass;

Registering assets

$this->publishAssets(__DIR__ . '/path/to/assets');
$this->registerCssFile('css/styles.css');
$this->registerScriptFile('js/script.js');

The Versions

11/02 2014

dev-master

9999999-dev

Tools for building extensions for the Yii PHP framework.

  Sources   Download

BSD-3-Clause

11/02 2014

1.2.0

1.2.0.0

Tools for building extensions for the Yii PHP framework.

  Sources   Download

BSD-3-Clause

11/02 2014

dev-develop

dev-develop

Tools for building extensions for the Yii PHP framework.

  Sources   Download

BSD-3-Clause

03/09 2013

1.1.1

1.1.1.0

Tools for building extensions for the Yii PHP framework.

  Sources   Download

BSD-3-Clause

01/09 2013

1.1.0

1.1.0.0

Tools for building extensions for the Yii PHP framework.

  Sources   Download

BSD-3-Clause

01/09 2013

1.0.0

1.0.0.0

Tools for building extensions for the Yii PHP framework.

  Sources   Download

BSD-3-Clause

05/07 2013

dev-no-namespaces

dev-no-namespaces

Tools for building extensions for the Yii PHP framework.

  Sources   Download

BSD-3-Clause