morrislaptop / laravel-five-package-bridges
在 Laravel 5 中使用 Laravel 4 包
1.0.3
2015-03-02 21:50 UTC
Requires
- laravel/framework: ~5.0
Requires (Dev)
- camroncade/timezone: dev-master
- cartalyst/sentry: ~2.1
- intervention/image: ~2.0
- itsgoingd/clockwork: ~1.6
- laracasts/flash: ~1.3
- maatwebsite/excel: ~1.2
- orchestra/testbench: ~3.0@dev
- phpunit/phpunit: ~4.4
- robbiep/cloudconvert-laravel: ~2.0@beta
- way/generators: ~3.0
Suggests
- camroncade/timezone: Addon to assist with Timezone managemenr
- cartalyst/sentry: A framework agnostic authentication & authorization system. http://www.cartalyst.com
- intervention/image: PHP Image Manipulation http://image.intervention.io
- itsgoingd/clockwork: Server-side component of Clockwork, a Chrome extension for PHP development.
- laracasts/flash: Easy flash notifications https://packagist.org.cn/packages/laracasts/flash
- maatwebsite/excel: An eloquent way of importing and exporting Excel and CSV files for Laravel with the power of PHPExcel http://www.maatwebsite.nl/laravel-excel/docs
- robbiep/cloudconvert-laravel: Provides API access to CloudConvert.com
- way/generators: Rapidly speed up your Laravel workflow with generators https://packagist.org.cn/packages/way/generators
Replaces
- illuminate/support: ~4.2
This package is auto-updated.
Last update: 2024-08-26 03:33:40 UTC
README
这个 Laravel 包提供了一个桥梁特质和多个桥梁,允许 Laravel 4 包在 Laravel 5 中使用。
当前已桥梁的包有
- laracasts/flash
- way/generators
- intervention/image
- maatwebsite/excel
- itsgoingd/clockwork
- cartalyst/sentry
- robbiep/cloudconvert-laravel
- camroncade/timezone
- laracasts/utilities
如果你想要构建一个桥梁,请遵循贡献指南。
安装
首先通过 Composer 安装此包。
composer require morrislaptop/laravel-five-package-bridges
此操作完成后,添加配置服务提供者,这会将 package() 方法带回配置存储库。打开 app/config/app.php 并添加..
'Morrislaptop\LaravelFivePackageBridges\ConfigServiceProvider',
然后我们需要用桥梁替换核心 Application 类,这会添加各种方法如 after() 等。打开 bootstrap/app.php 并替换..
$app = new Illuminate\Foundation\Application( realpath(__DIR__.'/../') );
为
$app = new Morrislaptop\LaravelFivePackageBridges\Application( realpath(__DIR__.'/../') );
最后一步是将桥梁服务提供者添加到原始服务提供者中。
打开 app/config/app.php,并添加适当的行。
'Morrislaptop\LaravelFivePackageBridges\Bridges\FlashServiceProvider',
'Morrislaptop\LaravelFivePackageBridges\Bridges\GeneratorsServiceProvider',
'Morrislaptop\LaravelFivePackageBridges\Bridges\ImageServiceProvider',
'Morrislaptop\LaravelFivePackageBridges\Bridges\ExcelServiceProvider',
'Morrislaptop\LaravelFivePackageBridges\Bridges\ClockworkServiceProvider',
'Morrislaptop\LaravelFivePackageBridges\Bridges\SentryServiceProvider',
就这样!这些包现在就像在 Laravel 4 中一样正常工作了。
自定义包
如果你有一个私有包,你可以简单地创建自己的桥梁服务提供者,并从该包中引入特质。
<?php namespace App\Bridges; use Morrislaptop\LaravelFivePackageBridges\LaravelFivePackageBridgeTrait; use Acme\Private\NuclearServiceProvider as BaseNuclearServiceProvider; class NuclearServiceProvider extends BaseNuclearServiceProvider { use LaravelFivePackageBridgeTrait; }
贡献
请参阅贡献指南。