Package Data | |
---|---|
Maintainer Username: | jumilla |
Maintainer Contact: | fumio@jumilla.me (Fumio Furukawa) |
Package Create Date: | 2015-10-31 |
Package Last Update: | 2017-09-19 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-26 15:04:07 |
Package Statistics | |
---|---|
Total Downloads: | 1,004 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 6 |
Total Watchers: | 5 |
Total Forks: | 0 |
Total Open Issues: | 1 |
Additional add-on features
{addon-name}::
can be used 'lang', 'view'. Also can use 'config'.php artisan make:addon
.Solution of a facade problem in the namespace
Note: Pacakge Discovery supported.
It is a way to use a model project already to incorporate the Laravel Extension Pack.
In addition to the Laravel Addomnipot of add-on features, and to the Laravel Versionia of semantic version-based migration feature, you can also use source code generator corresponding to the add-on.
composer create-project laravel-plus/laravel5 <project-name>
laravel-plus/extension
to an existing project.Note: Pacakge Discovery supported.
It is a way to use Laravel Extension Pack.
In addition to the Laravel Addomnipot of add-on features, and to the Laravel Versionia of semantic version-based migration feature, you can also use source code generator corresponding to the add-on.
For more information, please refer to the Laravel Extension Pack of the document.
jumilla/laravel-addomnipot
to an existing project.Note: Pacakge Discovery supported.
It is a way to incorporate the only Laravel Addomnipot of add-on features.
jumilla/laravel-addomnipot
use Composer.Use composer.
composer require jumilla/laravel-addomnipot
Edit file config/app.php
.
'providers' => [
Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
...
// Add the folloing line.
Jumilla\Addomnipot\Laravel\ServiceProvider::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
addon:list
List addons.
php artisan addon:list
When addons
directory file don't exist, it's made.
addon:status
Can check the status of addons.
php artisan addon:status
When addons
directory 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 Wonderful/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 library
-type, blog-app
is generated as PHP name spatial BlogApp
using a form of ui
-type.
php artisan make:addon blog library
php artisan make:addon blog-app ui
A skeleton can be chosen from 10 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
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());
}
}
LaravelPlus\Extension\Addons\Addon
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\Http\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