prezire / facade-generator
An Artisan command that generates a Service Provider and Facade based on your existing custom Service class file.
dev-master
2019-10-26 00:36 UTC
This package is auto-updated.
Last update: 2024-12-26 11:47:53 UTC
README
An Artisan command that generates a Service Provider and Facade based on your existing custom Service class file.
Installation
composer require prezire/facade-generator
Usage
php artisan make:facade [FacadeAliasName] [TargetServiceFile]
Example: Create a FooBar facade based on Foo service class file.
php artisan make:facade FooBar \\App\\Services\\Foo
You must register the generated provider and alias for the facade in `config/app.php' file.
'providers' => [ App\Providers\Facades\FooBarServiceProvider::class, ], 'aliases' => [ 'FooBar' => App\Facades\FooBar::class, ],
Using the Facade.
Route::get('/', function () { return \FooBar::doSomething(); });