PHPackages                             hyder/facade-pattern - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hyder/facade-pattern

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hyder/facade-pattern
====================

In this pattern, you would create Facade classes that provide a simplified, static interface to the underlying service implementations. The service classes would perform the actual business logic and communicate with the database or other external systems.

2.0.0(3y ago)031MITPHPPHP ^7.3|^8.0

Since Apr 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/abhihyder/facade-pattern)[ Packagist](https://packagist.org/packages/hyder/facade-pattern)[ RSS](/packages/hyder-facade-pattern/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (4)Used By (0)

Laravel Facade Pattern Scaffolding
----------------------------------

[](#laravel-facade-pattern-scaffolding)

This package provides scaffolding for the Facade Pattern in Laravel. The Facade Pattern is a design pattern that helps to separate the business logic from the controller or other client code, making it easier to maintain and test.

Why Facade Pattern instead of Repository Pattern?
-------------------------------------------------

[](#why-facade-pattern-instead-of-repository-pattern)

In the Repository Pattern, the implementation of the data access layer is abstracted behind an interface. This interface defines the methods that the repository must implement, but it doesn't provide any way to access the underlying implementation details.

This lack of flexibility can be problematic in cases where you need to access the implementation details of the repository from other parts of the code. For example, if you need to access the repository from within a queued job or another simple class, you can't simply create a new instance of the repository because it's abstracted behind an interface.

One workaround for this issue is to pass the repository instance to the queued job or simple class as a parameter, but this can lead to tight coupling and make the code harder to maintain.

Another workaround is to use a dependency injection container to provide an instance of the repository to the queued job or simple class. However, this can add additional complexity and require additional configuration.

Overall, the lack of flexibility in the Repository Pattern can be a disadvantage in certain situations, especially when you need to access the implementation details of the repository from other parts of the code.

Here comes the solution with Facade Pattern. You can easily access the Facade from within a queued job or another simple class.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require hyder/facade-pattern --dev
```

Publish Provider
----------------

[](#publish-provider)

After installation, you need to run the `vendor:publish` command to publishing provider file. You can do this by running the following command:

```
php artisan vendor:publish --provider=Hyder\FacadePattern\FacadePatternServiceProvider --tag=provider
```

This will publish the package's `FacadeServiceProvider` to the `app/Providers` directory, which you can then modify as needed.

The `FacadeServiceProvider` class is responsible for registering the service classes for Facade with the Laravel container. This allows you to easily swap out the implementation of the service classes if needed.

Configuration
-------------

[](#configuration)

You have to manually add the service provider in your config/app.php file:

```
'providers' => [
    // ...
    App\Providers\FacadeServiceProvider::class,
];
```

Create Scaffolding
------------------

[](#create-scaffolding)

Now you can run the `facade-pattern:scaffold` command to generate the necessary scafolding files. You can do this by running the following command:

```
php artisan facade-pattern:scaffold Example
```

This will create the following files in your app directory:

```
app/
└── Patterns/
    ├── Facades/
    │   ├── Facade.php
    │   └── ... other facades
    ├── Interfaces/
    │   ├── Interface.php
    │   └── ... other interfaces
    └── Services/
        ├── FacadeService.php
        └── ... other services

```

- The `Patterns/Facades` directory contains the Facade classes, which provide a simple, consistent interface to the underlying service classes. You can create additional Facade classes as needed.
- The `Patterns/Interfaces` directory contains the repository interfaces, which define the methods that the service classes must implement. You can create additional interface files as needed.
- The `Patterns/Services` directory contains the service classes, which perform the actual business logic and communicate with the database or other external systems. You can create additional service classes as needed.

Create Facade, Interface and Service
------------------------------------

[](#create-facade-interface-and-service)

By running the `facade-pattern:facade`, `facade-pattern:interface`, and `facade-pattern:service` command you can generate the necessary file. You can do this by running the following command:

### Facade

[](#facade)

```
php artisan facade-pattern:facade ExampleFacade
```

### Interface

[](#interface)

```
php artisan facade-pattern:interface ExampleInterface
```

### Service

[](#service)

```
php artisan facade-pattern:service ExampleFacadeService
```

Don't forget to register your facade service class in `FacadeServiceProvider` provider's register() method.
That's it! You can now start using the Facade Pattern in your Laravel application.

Contributing
------------

[](#contributing)

If you would like to contribute to this package, please create a pull request or open an issue.

License
-------

[](#license)

This package is open-source software released under the [MIT license](https://opensource.org/licenses/MIT). Feel free to modify and use the package in your own projects.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Total

3

Last Release

1147d ago

Major Versions

1.1.0 → 2.0.02023-05-13

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/55033824?v=4)[Tofayel Hyder Abhi](/maintainers/abhihyder)[@abhihyder](https://github.com/abhihyder)

---

Top Contributors

[![abhihyder](https://avatars.githubusercontent.com/u/55033824?v=4)](https://github.com/abhihyder "abhihyder (7 commits)")

---

Tags

laravelpatternhyderFacade Pattern

### Embed Badge

![Health badge](/badges/hyder-facade-pattern/health.svg)

```
[![Health](https://phpackages.com/badges/hyder-facade-pattern/health.svg)](https://phpackages.com/packages/hyder-facade-pattern)
```

###  Alternatives

[getsolaris/laravel-make-service

A MVCS pattern create a service command for Laravel 5+

81173.8k](/packages/getsolaris-laravel-make-service)[stephenjude/filament-blog

Filament Blog Builder

20619.4k](/packages/stephenjude-filament-blog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
