パッケージ入れるときのメモです。
環境
- Laravel 5.1を想定
IDE Helper導入
https://github.com/barryvdh/laravel-ide-helper
IDEでのコーディングが便利になるやーつ
composer require barryvdh/laravel-ide-helper --dev
providers
に追加
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
生成
php artisan ide-helper:generate
post-update-cmdに追加
"scripts":{
"post-update-cmd": [
+ "php artisan ide-helper:generate",
"php artisan optimize"
]
},
設定ファイル出力
php artisan vendor:publish
ENTRUST導入
https://github.com/Zizaco/entrust
Role方式の認証を追加してくれるパッケージです。
composerに追加
composer require zizaco/entrust:dev-laravel-5
providers追加
Zizaco\Entrust\EntrustServiceProvider::class,
alias追加
'Entrust' => Zizaco\Entrust\EntrustFacade::class,
Kernel.phpのrouteMiddlewareに追加
'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class,
configをpublish
php artisan vendor:publish
migrationを生成
php artisan entrust:migration
作っていいか聞かれるのでそのままEnter.
ardentの導入
https://github.com/laravel-ardent/ardent
modelでバリデーションできるようになるやつ
composer require laravelbook/ardent:3.*
generatorsの導入
artisanコマンドに色々増えるやーつ
https://github.com/laracasts/Laravel-5-Generators-Extended
composer require laracasts/generators --dev
AppServiceProviderのregisterメソッドに追加
if ($this->app->environment() == 'local') {
$this->app->register('Laracasts\Generators\GeneratorsServiceProvider');
}
formerの導入
https://github.com/formers/former
formの出力が楽になるやーつ
composer require anahkiasen/former:4.0.*@dev
providersに追加
Former\FormerServiceProvider::class,
aliasにも追加
'Former' => Former\Facades\Former::class,
publish
php artisan vendor:publish
Bootstrapperの導入
https://github.com/patricktalmadge/bootstrapper
bootstrapを利用している時のHTML出力が楽になるやーつ
composer require patricktalmadge/bootstrapper:~5
providersに追加
Bootstrapper\BootstrapperL5ServiceProvider::class,
aliasesに追加(いらなさそうな奴は消しましょう。あとFormとかImageとか被りそうなので気をつけて)
'Accordion' => 'Bootstrapper\Facades\Accordion',
'Alert' => 'Bootstrapper\Facades\Alert',
'Badge' => 'Bootstrapper\Facades\Badge',
'Breadcrumb' => 'Bootstrapper\Facades\Breadcrumb',
'Button' => 'Bootstrapper\Facades\Button',
'ButtonGroup' => 'Bootstrapper\Facades\ButtonGroup',
'Carousel' => 'Bootstrapper\Facades\Carousel',
'ControlGroup' => 'Bootstrapper\Facades\ControlGroup',
'DropdownButton' => 'Bootstrapper\Facades\DropdownButton',
'Form' => 'Bootstrapper\Facades\Form',
'Helpers' => 'Bootstrapper\Facades\Helpers',
'Icon' => 'Bootstrapper\Facades\Icon',
'InputGroup' => 'Bootstrapper\Facades\InputGroup',
'Image' => 'Bootstrapper\Facades\Image',
'Label' => 'Bootstrapper\Facades\Label',
'MediaObject' => 'Bootstrapper\Facades\MediaObject',
'Modal' => 'Bootstrapper\Facades\Modal',
'Navbar' => 'Bootstrapper\Facades\Navbar',
'Navigation' => 'Bootstrapper\Facades\Navigation',
'Panel' => 'Bootstrapper\Facades\Panel',
'ProgressBar' => 'Bootstrapper\Facades\ProgressBar',
'Tabbable' => 'Bootstrapper\Facades\Tabbable',
'Table' => 'Bootstrapper\Facades\Table',
'Thumbnail' => 'Bootstrapper\Facades\Thumbnail',
publish
php artisan vendor:publish
LaravelCollective(HTML)の導入
https://laravelcollective.com/
HTMLの出力らくになるやーつ(Bootstrapper入れたからいらないかも)
composer require laravelcollective/html:5.1.*
providersに追加(多分bootstrapperより上に書いたほうが良い)
Collective\Html\HtmlServiceProvider::class,
aliasの追加(Formは他のやつで補うのでいらない
'Html' => Collective\Html\HtmlFacade::class,
Laravel Debugbarの導入
https://github.com/barryvdh/laravel-debugbar
デバッグが簡単にできるようになるバーが表示される
composer require barryvdh/laravel-debugbar --dev
AppServiceProviderのregisterに追加。aliasをここで指定してちゃんと動いてくれるのかは不明なのであとで調べよう
if ($this->app->environment() == 'local') {
$this->app->register(\Barryvdh\Debugbar\ServiceProvider::class);
$this->app->alias('Debugbar', \Barryvdh\Debugbar\Facade::class);
}
追記。どうやら、Facadeのエイリアス指定をしたとしてもAliasLoaderはBootstrap時にはconfigのapp.aliasesを渡す模様なので、これは出来ないみたい。
AppServiceProviderで\Illuminate\Foundation\AliasLoader::getInstance(['Debugbar', \Barryvdh\Debugbar\Facade::class])->register();
とかやってみたが、結局動かなかったし、ide-helperの補完も効かなくなるのでFacadeの指定はconfigでやるしか無さそうですね。