Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sunaoka/laravel-facade-generator

Facade generator for Laravel 5.8 to 11.x
https://github.com/sunaoka/laravel-facade-generator

artisan generator laravel laravel-package laravel10 laravel11 laravel5 laravel6 laravel7 laravel8 laravel9 php php7 php8 php81 php82

Last synced: 3 months ago
JSON representation

Facade generator for Laravel 5.8 to 11.x

Awesome Lists containing this project

README

        

# Facade generator for Laravel

[![Latest Stable Version](https://poser.pugx.org/sunaoka/laravel-facade-generator/v/stable)](https://packagist.org/packages/sunaoka/laravel-facade-generator)
[![License](https://poser.pugx.org/sunaoka/laravel-facade-generator/license)](https://packagist.org/packages/sunaoka/laravel-facade-generator)
[![PHP from Packagist](https://img.shields.io/packagist/php-v/sunaoka/laravel-facade-generator)](composer.json)
[![Laravel](https://img.shields.io/badge/laravel-%3E=%205.8-red)](https://laravel.com/)
[![Test](https://github.com/sunaoka/laravel-facade-generator/actions/workflows/test.yml/badge.svg)](https://github.com/sunaoka/laravel-facade-generator/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/sunaoka/laravel-facade-generator/branch/develop/graph/badge.svg)](https://codecov.io/gh/sunaoka/laravel-facade-generator)

----

It is an artisan console command that generates services, service providers and facades.

## Installation

```bash
composer require --dev sunaoka/laravel-facade-generator
```

## Usage

```bash
php artisan make:facade [Facade Name]
```

## Configurations

```bash
php artisan vendor:publish --tag=facade-generator-config
```

```php
[
'facade' => '',
'service' => 'Service',
'provider' => 'ServiceProvider',
],

/*
|--------------------------------------------------------------------------
| Generate test
|
| If `false`, no test will be generated.
|--------------------------------------------------------------------------
*/

'test' => true,
];
```

## Example

```bash
php artisan make:facade Foo
```

### Generated: app/Facades/Foo.php

```php
app->bind('Foo', FooService::class);
}
}
```

### Generated: app/Services/FooService.php

```php
[
App\Providers\FooServiceProvider::class,
],

'aliases' => [
'Foo' => App\Facades\Foo::class,
],
```

### Laravel 11.x

You must add a providers in `bootstrap/providers.php`.

```php
return [
App\Providers\FooServiceProvider::class,
];
```

and, You must add an aliases in `config/app.php`.

```php
'aliases' => [
'Foo' => App\Facades\Foo::class,
],
```