Package Data | |
---|---|
Maintainer Username: | jumilla |
Maintainer Contact: | fumio@jumilla.me (Fumio Furukawa) |
Package Create Date: | 2014-06-07 |
Package Last Update: | 2017-09-19 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-11 15:07:59 |
Package Statistics | |
---|---|
Total Downloads: | 1,795 |
Monthly Downloads: | 8 |
Daily Downloads: | 5 |
Total Stars: | 55 |
Total Watchers: | 7 |
Total Forks: | 5 |
Total Open Issues: | 1 |
Additional version-based migration features
App/Providers/DatabaseServiceProvider
.Additional add-on features
{addon-name}::
can be used 'lang', 'view'. Also can use 'config'.php artisan make:addon
.Commands of file generation
make:xxx
. Command names and options are the same.--addon
option, you can also generate a file in the add-on.Solution of a facade problem in the namespace
composer create-project laravel-plus/laravel5 <project-name>
laravel-plus/extension
use Composer.Use composer.
composer require laravel-plus/extension
Edit file config/app.php
.
LaravelPlus\Extension\ServiceProvider::class
in providers
section.Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class
in providers
section. 'providers' => [
Illuminate\View\ViewServiceProvider:class,
...
// Add the folloing line.
LaravelPlus\Extension\ServiceProvider::class,
],
'providers' => [
// Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
],
Add-on wiki
is made as a example.
php artisan make:addon wiki sample:ui
Please confirm the routing setting.
php artisan route:list
A local server is started and accesses http://localhost:8000/addons/wiki
by a browser.
When a package name is indicated, it's success.
php artisan serve
database:status
Migration, seed's definition and installation state are indicated.
php artisan database:status
database:upgrade
up()
method in migration of all groups, it's carried out and it's made a newest version.
php artisan database:upgrade
It's possible to make them seed after my gray-tion.
php artisan database:upgrade --seed <seed>
database:clean
down()
method in migration of all groups, , it's carried out and it's returned in the clean state.
php artisan database:clean
database:refresh
Re-run migration of all groups.
After database:clean
and database:upgrade
were carried out, same.
php artisan database:refresh
It's possible to make them seed after migration.
php artisan database:refresh --seed <seed>
database:rollback
The version of the specified group is returned one.
php artisan database:rollback <group>
When --all
option is put, everything's version of the designation group is eliminated.
php artisan database:rollback <group> --all
database:again
A newest version of a specified group is made.
I have the same effect as the time when database:rollback <group>
and database:upgrade
were carried out.
php artisan database:again <group>
It's possible to make them seed after migration.
php artisan database:again <group> --seed <seed>
database:seed
Run specified seed.
php artisan database:seed <seed>
When omitting <seed>
, run default seed.
php artisan database:seed
addon:status
Can check the status of addons.
php artisan addon:status
When addons
directory and config/addon.php
file don't exist, it's made.
addon:name
A file in the add-on is scanned and the PHP namespace is changed.
php artisan addon:name blog Wonderful/Blog
When you'd like to confirm the scanned file, please designate -v
option.
php artisan addon:name blog Sugoi/Blog -v
addon:remove
An add-on is eliminated.
php artisan addon:remove blog;
addons/blog
A directory is just eliminated.
make:addon
An add-on is made.
I add on the next command blog
is generated as PHP name spatial Blog
using a form of ui
-type.
php artisan make:addon blog ui
A skeleton can be chosen from 9 kinds.
When not designating a form by a command argument, it can be chosen by an interactive mode.
php artisan make:addon blog
PHP namespace can designate --namespace
by an option.
Please use \\
or /
for a namespace separate.
php artisan make:addon blog --namespace App\\Blog
php artisan make:addon blog --namespace App/Blog
Generate a class of artisan command.
If you specify foo
to name, to generate a file app/Console/Commands/Foo.php
.
$ php artisan make:console foo
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Commands/Foo.php
.
$ php artisan make:console foo --addon=blog
Generate a class of controller.
If you specify FooController
to name, to generate a file app/Http/Controllers/FooController.php
.
$ php artisan make:controller FooController
If you specify option --resource
, to generate a resource controller.
$ php artisan make:controller FooController --resource
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Controllers/FooController.php
.
$ php artisan make:controller FooController --addon=blog
Generate a class of event.
If you specify FooEvent
to name, to generate a file app/Events/FooEvent.php
.
$ php artisan make:event FooEvent
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Events/FooEvent.php
.
$ php artisan make:event FooEvent --addon=blog
Generate a class of job.
If you specify a FooJob
to name, to generate a file app/Jobs/FooEvent.php
.
$ php artisan make:job FooJob
If you specify option --queued
, to generate a job class implemented ShouldQueue
interface.
$ php artisan make:job FooJob --queued
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Jobs/FooJob.php
.
$ php artisan make:job FooJob --addon=blog
If using a App/Commands
directory of Laravel 5.0, app/Commands/FooCommand.php
can also be generated.
$ php artisan make:job /Commands/FooCommand
Generate a class of listener.
If you specify FooListener
to name, to generate a file app/Listeners/FooListener.php
.
Require --event
option.
$ php artisan make:listener FooListener --event=bar
If you specify option --queued
, to generate a job class implemented ShouldQueue
interface.
$ php artisan make:listener FooListener --event=bar --queued
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Listeners/FooListener.php
.
$ php artisan make:listener FooListener --event=bar --addon=blog
Generate a class of middleware.
If you specify foo
to name, to generate a file app/Http/Middleware/Foo.php
.
$ php artisan make:middleware foo
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Middleware/Foo.php
.
$ php artisan make:middleware foo --addon=blog
Generate a class of migration.
If you specify foo
to name, to generate a file app/Database/Migrations/App_1_0.php
.
$ php artisan make:migration App_1_0
If you specify materials
to option --create
, to generate a migration class for create materials table.
$ php artisan make:migration App_1_1 --create=materials
If you specify materials
to option --update
, to generate a migration class for update materials table.
$ php artisan make:migration App_1_2 --update=materials
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Migrations/Blog_1_0.php
.
$ php artisan make:migration Blog_1_0 --addon=blog
Generate a class of Eloquent model.
If you specify foo
to name, to generate a file app/Foo.php
related to foos table.
$ php artisan make:model foo
If you specify services/models/foo
to name, to generate a file app/Services/Models/Foo.php
related to foos table.
PHP namespace will be App\Services\Models
.
$ php artisan make:model services/models/foo
If you specify App_1_1
to option --migration
, also generates together migration file.
This is the same as a result of executing the command php artisan make:migration App_1_1 --create=foos
.
$ php artisan make:model foo --migration=App_1_1
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Foo.php
.
$ php artisan make:model foo --addon=blog
Generate a class of policy.
If you specify foo
to name, to generate a file app/Policies/Foo.php
.
$ php artisan make:policy foo
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Policies/Foo.php
.
$ php artisan make:policy foo --addon=blog
Generate a class of service provider.
If you specify FooServiceProvider
to name, to generate a file app/Providers/FooServiceProvider.php
.
$ php artisan make:provider FooServiceProvider
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Providers/FooServiceProvider.php
.
$ php artisan make:provider FooServiceProvider --addon=blog
Generate a class of form request.
If you specify FooRequest
to name, to generate a file app/Http/Requests/FooRequest.php
.
$ php artisan make:request FooRequest
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Requests/FooRequest.php
.
$ php artisan make:request FooRequest --addon=blog
Generate a class of seeder.
If you specify staging
to name, to generate a file app/Database/Seeds/Staging.php
.
$ php artisan make:request staging
If you specify blog
to option --addon
, to generate a file addons/blog/classes/Seeds/Staging.php
.
$ php artisan make:request staging --addon=blog
Generate a class of PHPUnit test suite.
If you specify FooTests
to name, to generate a file tests/FooTests.php
.
$ php artisan make:test FooTests
If you specify blog
to option --addon
, to generate a file addons/blog/tests/FooTests.php
.
$ php artisan make:test FooTests --addon=blog
Get the add-on by name.
$addon = addon('blog');
If omit the name, it returns the add-on that contains the calling class.
This is equivalent to a addon(addon_name())
.
namespace Blog\Http\Controllers;
class BlogController
{
public function index()
{
$addon = addon(); // == addon(addon_name())
Assert::same('blog', $addon->name());
}
}
object retrieved by the addon()
function, you can access the add-on attributes and resources.
$addon = addon();
$addon->path(); // {$root}/addons/blog
$addon->relativePath(); // addons/blog
$addon->phpNamespace(); // Blog
$addon->config('page.row_limit', 20);
$addon->trans('emails.title');
$addon->transChoice('emails.title', 2);
$addon->view('layouts.default');
$addon->spec('forms.user_register');
Get the add-on name from the class name . The class name must be a fully qualified name that contains the name space. Get the add-on by name.
$name = addon_name(get_class($this));
$name = addon_name(\Blog\Providers\AddonServiceProvider::class); // 'blog'
If you omit the argument, returns the name of the add-on contains the caller of the class.
<?php
namespace Blog\Controllers;
class PostsController
{
public function index()
{
$name = addon_name(); // 'blog'
}
}
Facade of Laravel converts the static method call of class to an instance method invocation, and has been achieved by creating an alias for the facade class in the global namespace.
For Laravel 5 alias loader does not act only in the global name space , to handle the facade from the name space (such as App
) it must put \
to the class name prefix.
function index()
{
return \View::make()
}
Or a use declaration is used.
use View;
...
function index()
{
return View::make()
}
Laravel Extension has the alias loader which settles a facade in the namespace in the add-on bottom, so a way of Laravel 4.2 formula document mentioning can be used just as it is.
function index()
{
return View::make()
}
files
entry in file addons/{addon-name}/addon.json
.namespace
entry in file addons/{addon-name}/addon.php
and establishes class automatic threading based on PSR-4 agreement to all directories specified as directories
.古川 文生 / Fumio Furukawa (fumio@jumilla.me)
MIT