2017 © Pedro Peláez
 

library yii-illuminate

A bridge to Laravel awesomeness

image

cst/yii-illuminate

A bridge to Laravel awesomeness

  • Thursday, October 6, 2016
  • by cyakimov
  • Repository
  • 4 Watchers
  • 0 Stars
  • 641 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

This package makes easy the integration with some Laravel components, (*1)

Requirements

The following versions of PHP are supported., (*2)

  • PHP 5.6
  • HHVM (not tested)

Installation

You can install the package using the Composer package manager. You can install it by running this command in your project root:, (*3)

composer require cst/yii-illuminate

Components

Migrate command

Supercharges Yii MigrateCommand with all the functionality of the Laravel Schema Builder, (*4)

Add the following block to your config file:, (*5)

'commandMap'=> [
    'migrate'=> [
        'class' => '\CST\Yii\Illuminate\Console\MigrateCommand',
        'migrationTable' => 'yii_migrations',
        'connectionID' => 'db',
    ],
],

Queues

Queues allow you to defer the processing of a time consuming task, such as sending an e-mail, until a later time, thus drastically speeding up the web requests to your application., (*6)

RedisQueue, (*7)

Add the following block to your config file:, (*8)

'queue' => [
    'class' => '\CST\Yii\Illuminate\Queue\RedisQueue',
    'encryptionKey' => '<random-string-of-16bytes>',
    'config' => [
        'cluster' => false,
        'default' => [
            'host'     => '<HOST>',
            'port'     => 6379,
            'database' => 0,
        ],
    ]
],

Configuring queue command, (*9)

Add the following block to your config file:, (*10)

'commandMap'=> [
    ...,
    'queue'=> [
        'class' => '\CST\Yii\Illuminate\Console\QueueCommand',
    ],
],

Queuing jobs:, (*11)

Yii::app()->queue->push(new SendEmail($message));

or, (*12)

use CST\Yii\Illuminate\Queue\DispatchesJobs;

$this->dispatch(new SendEmail($message));

Helper Functions

app(string $component = null)

Get the Yii App instance. It's a shortcut for Yii::app(). You can also pass the component name to get the instance., (*13)

app('clientScript')->registerScriptFile(...);
t(string $category, string $message, array $params = [], string $source = null, string $language = null)

Yii::t() shortcut for translating messages., (*14)

t('Project', 'Save changes');
view(string $path, array $data, bool $return)

Renders evaluated view contents for the given view. Replaces the typical $this->render(...), (*15)

view('user/view', ['user' => $user]);
viewPartial(string $path, array $data, bool $return)

Renders evaluated view contents for the given view and it does not apply a layout to the rendered result. Replaces the typical $this->renderPartial(...), (*16)

viewPartial('user/pic', ['user' => $user]);
request(string $key, $default = null)

Get an instance of the current request or an input item from the request., (*17)

$modelId = request('id')
asset(string $path)

Generate an asset path for the application theme., (*18)

asset('js/main.js');
asset('images/logo.png');
url(string $path, array $parameters, bool $secure)

Generate a url for the application., (*19)

url('project/view', ['id' => 1]);

The Versions