hmones / laravel-facade
Generates facades in your laravel project with one simple command.
Installs: 1 082
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- composer-runtime-api: ^2.0
- illuminate/support: ~7|~8|~9
Requires (Dev)
- orchestra/testbench: ~5|~6|~7
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-11-10 19:40:52 UTC
README
This package makes the process of creating facades in laravel super easy and with one simple artisan command. For each facade created with this package:
- A Facade file is created in
App\Facades
to define the facade accessor. - A Facade service provider
App\Providers\FacadeServiceProvider.php
is created/edited to bind your implementation class to the facade accessor. - The
FacadeServiceProvider
is registered in your app configuration file (config\app.php
).
Installation
Via Composer
composer require hmones/laravel-facade --dev
Configuration
To publish the package configuration
php artisan vendor:publish --tag=laravel-facade-config
The configuration contains the following values:
<?php return [ 'provider' => [ 'name' => 'FacadeServiceProvider', 'namespace' => 'App\Providers', ], ];
- The name attribute represents the name of the provider file that will hold all the bindings between Facades and implementation classes, this provider will be then registered automatically in the app configuration.
- The namespace attribute represents the namespace for your application providers and where the FacadeServiceProvider file will be created, so in case you use a different folder you need to change that.
Usage
To create a new Facade for a particular class you can simply use the following command which accepts two inputs:
- Facade Name: The name of the Facade class that you would like to create.
- Class Path: the path to the class file that you would like to implement inside the app directory of your
application. e.g. ExampleController can be located by default at
Http\Controllers\ExampleController.php
php artisan make:facade FacadeName Custom/ImplementedClass.php
To remove a Facade
php artisan remove:facade FacadeName
To publish the facade service provider Note: You normally do not need to do this step because if the provider doesn't exist, it will be automatically published when you create a new Facade.
php artisan vendor:publish --tag=laravel-facade-provider
Change log
Please see the changelog for more information on what has changed recently.
Testing
composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
License
license. Please see the license file for more information.