zeus/facade

the facade and container

v1.0.0 2025-03-30 05:07 UTC

This package is auto-updated.

Last update: 2025-03-30 05:08:18 UTC


README

Facade and container

An advanced container and facade architecture, The aim is to automatically bind dependency injections.

to install

composer require zeus/facade

The short code for the using of the following

use Zeus\Facade\AbstractFacade;
use Zeus\Facade\Container;

require_once 'vendor/autoload.php';

class Login extends AbstractFacade
{
    public static function getFacade(): string
    {
        return 'login';
    }
}


$container = new Container();
AbstractFacade::setContainer($container);


$container->bind(LoginServiceInterface::class, LoginService::class);
$container->bind('login', LoginController::class);


echo Login::login('john_doe', 'password123') . PHP_EOL; // "Login successful for john_doe at 2025-03-28 14:30:45"

The fake

use \Zeus\Facade\Tests\stubs\Http;

Http::fake('get',function (){
    return 'fake';
})

echo Http::get(); //fake

or middleware

Http::middleware(function (string $method,array $parameters,Closure $next){
    return $next($method,$parameters);
});