Download the PHP package imanghafoori/laravel-smart-facades without Composer
On this page you can find all versions of the php package imanghafoori/laravel-smart-facades. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download imanghafoori/laravel-smart-facades
More information about imanghafoori/laravel-smart-facades
Files in imanghafoori/laravel-smart-facades
Package laravel-smart-facades
Short Description Adds some features on the top of laravel facades
License MIT
Homepage https://github.com/imanghafoori1/laravel-smart-facades
Informations about the package laravel-smart-facades
🍄 Laravel Smart Facades 🍄
The "Strategy pattern" in Laravel, made easy
by adding some features on top of Laravel facades.
by adding some features on top of Laravel facades.
Built with :heart: for every smart Laravel developer [![Code Quality](https://scrutinizer-ci.com/g/imanghafoori1/laravel-smart-facades/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/imanghafoori1/laravel-smart-facades/?branch=master) [![Software License](https://img.shields.io/badge/license-MIT-blue.svg?style=round-square)](LICENSE.md) [![Check Imports](https://github.com/imanghafoori1/laravel-smart-facades/actions/workflows/check_imports.yml/badge.svg?branch=master)](https://github.com/imanghafoori1/laravel-smart-facades/actions/workflows/check_imports.yml) [![StyleCI](https://github.styleci.io/repos/166631643/shield?branch=master)](https://github.styleci.io/repos/166631643)
:flashlight: Installation:
⚡️ No need to have getFacadeAccessor()
Before:
After:
⚡️ Setting the default driver by shouldProxyTo($class)
:
Instead of binding a string to a concrete class with an IOC container, you can choose the low-level implementation class like this:
You can proxy to any abstract string (or closure) bound on the IoC container.
Note: If you invoke it twice, it will override:
⚡️ Using Non-default Driver:
If you want to change the driver at call site:
⚡️ Method Hooks:
You can introduce some code "Before" and "after" a method call, remotely: (like event listeners on eloquent models)
Here we have told the system whenever the MyFacade::findUser($id)
method was called in the system, to perform a log.
⚡️ Choosing the driver, based on parameters value:
For example, let's say you want your facade to use an SMS-based driver by default, but if the text is very long (more than 200 chars) it should use an email driver.
You can do it like this:
:wrench: Automatic method injection when calling a method through a facade.
This the adds ability to enjoy automatic method injection when calling methods on POPOs (Plain Old Php Objects) WITHOUT any performance hit when you do not need it.
🐙 Example:
Calling Bar
through a Facade:
Before:
After:
:raising_hand: Contributing:
If you find an issue or have a better way to do something, feel free to open an issue or a pull request.
:star: Your Stars Make Us Do More :star:
As always if you found this package useful and you want to encourage us to maintain and work on it. Just press the star button to declare your willingness.
More from the author:
Laravel Microscope
:gem: Automatically find bugs before they bite.
Laravel Widgetize
:gem: A minimal yet powerful package to give a better structure and caching opportunity for your Laravel apps.
It's not I am smarter or something, I just stay with the problems longer. "Albert Einstein"
All versions of laravel-smart-facades with dependencies
illuminate/support Version ~5.1|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/events Version ~5.1|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0