neam/yii-yii2-bridge
Composer 安装命令:
composer require neam/yii-yii2-bridge
包简介
Use Yii 2 widgets in Yii 1 applications
README 文档
README
Use Yii 2 widgets in legacy Yii 1 applications.
Requirements
- Yii 1.1.15 application
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist "neam/yii-yii2-bridge" "*"
or add
"neam/yii-yii2-bridge" : "*"
to the require section of your application's composer.json file.
Make sure you have the following in your yii 1 app's composer.json:
"extra": { "asset-installer-paths": { "npm-asset-library": "vendor/npm", "bower-asset-library": "vendor/bower" } },
In your index.php, instead of including yii.php, do the following (which will include yii 1 and yii 2):
$approot = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..';
require("$approot/vendor/neam/yii-yii2-bridge/include.php");
Make sure that your layout or view file includes:
// Necessary in order to publish the yii2 assets required for this view
Yii::$app->getView()->registerYii2Assets();
Usage
Install yii 2 widgets via composer and use them as usual.
What this extension does
- Loads but does not run a Yii 2 app, so that it is available under Yii::$app.
- Overrides the core yii 2 view component to register asset files using Yii 1 client script.
- Disables the yii 2 error handler so that both error handlers are not activated at the same time.
What this extension does not do (yet... pull requests are welcome)
- Does not handle InputWidgets, only Widgets at the moment.
统计信息
- 总下载量: 213
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2014-12-08