jumilla/laravel-extension

Laravel Extension Pack

Installs: 168

Dependents: 0

Stars: 6

Watchers: 3

Language: PHP

v2.3.8 2015-08-18 14:23 UTC

README

Build Status Quality Score Latest Stable Version Total Downloads Software License

日本語ドキュメント - Japanese

Features

  • Addition of the add-on function

    • It's possible to use the directory structure of Laravel 5 in a copied image.
    • It's possible to make one of original name space (PSR-4) last in a package.
    • It can be handled as a package of Laravel 5.
      • Name spatial transcription of an identifier of lang, view {addon-name}:: can be used.
    • As add-on addition copies a directory. It isn't necessary to add a cord to the setting file of config/app.php etc..
    • 7 kinds of form and 2 kinds of sample are being prepared. It can be generated by php artisan make:addon.
  • Addition of the version base migration function

  • Solution of a facade problem in the namespace

    • A facade can be used in the class with a name space under the app directory. (A backslash and a use declaration, unnecessary)
    • A facade can also be handled by the same description method from the inside in add-on name space.

How to install

[A] The Laravel project which is already included is downloaded.

composer create-project laravel-plus/laravel5 <project-name>

[B] It's installed in a project of existence.

Use composer.

composer require laravel-plus/extension

Edit file config/app.php.

    'providers' => [
        ↓追加する
        'LaravelPlus\Extension\ServiceProvider',
        ...
        'Illuminate\Foundation\Providers\ArtisanServiceProvider',
        ...
    ],

An add-on setting file is installed. When I'd like to generate app/config/addon.php, it can be used anytime.

php artisan addon:status

Check for running

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

Commands

addon:status

The add-on state can be confirmed.

php artisan addon:status

When addons directory and app/config/addon.php file don't exist, it's made.

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.

  • minimum - Minimum structure.
  • simple - The simple construction with the views directory and the route.php.
  • library - The composition to which a PHP range and a database are offered.
  • api - The structure for API.
  • ui - Full-set including UI.
  • debug - The add-on in which program testing facility is put. Service provider registration of debug-bar is also included.
  • laravel5 - The directory structure of Laravel 5.
  • sample:ui - Example of a UI add-on.
  • sample:auth - The authentication sample included in Laravel 5.

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

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.

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

Facade expansion

I have to put \ on the head of the class name to handle a facade from the inside in namespace because an alias loader of Laravel 5 acts on only global namespace.

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()
}

Bootstrap behavior

  • Require files entry in file addons/{addon-name}/addon.json.
  • Sees 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.

Author

古川 文生 / Fumio Furukawa (fumio@jumilla.me)

License

MIT