This package makes easy the integration with some Laravel components
The following versions of PHP are supported.
- PHP 5.6
- HHVM (not tested)
You can install the package using the Composer package manager. You can install it by running this command in your project root:
composer require cst/yii-illuminate
Supercharges Yii MigrateCommand
with all the functionality of the Laravel Schema Builder
Add the following block to your config file:
'commandMap'=> [
'migrate'=> [
'class' => '\CST\Yii\Illuminate\Console\MigrateCommand',
'migrationTable' => 'yii_migrations',
'connectionID' => 'db',
],
],
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.
RedisQueue
Add the following block to your config file:
'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
Add the following block to your config file:
'commandMap'=> [
...,
'queue'=> [
'class' => '\CST\Yii\Illuminate\Console\QueueCommand',
],
],
Queuing jobs:
Yii::app()->queue->push(new SendEmail($message));
or
use CST\Yii\Illuminate\Queue\DispatchesJobs;
$this->dispatch(new SendEmail($message));
Get the Yii App instance. It's a shortcut for Yii::app(). You can also pass the component name to get the instance.
app('clientScript')->registerScriptFile(...);
t(string $category, string $message, array $params = [], string $source = null, string $language = null)
Yii::t() shortcut for translating messages.
t('Project', 'Save changes');
Renders evaluated view contents for the given view. Replaces the typical $this->render(...)
view('user/view', ['user' => $user]);
Renders evaluated view contents for the given view and it does not apply a layout to the rendered result. Replaces the typical $this->renderPartial(...)
viewPartial('user/pic', ['user' => $user]);
Get an instance of the current request or an input item from the request.
$modelId = request('id')
Generate an asset path for the application theme.
asset('js/main.js');
asset('images/logo.png');
Generate a url for the application.
url('project/view', ['id' => 1]);