hmones/laravel-facade

Generates facades in your laravel project with one simple command.
1,120 10
Install
composer require hmones/laravel-facade
Latest Version:v1.2.0
License:MIT
Last Updated:May 10, 2022
Links: GitHub  ·  Packagist
Maintainer: haythammones

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.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

631,580,251 9,707
laravel/framework

The Laravel Framework.

580,311,802 34,925
laravel/tinker

Powerful REPL for the Laravel framework.

489,754,436 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

404,034,618 608
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

384,821,166 4,658