PHP code example of effectra / facade
1. Go to this page and download the library: Download effectra/facade library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
effectra / facade example snippets
composer
use Effectra\Facade;
class MyFacade extends Facade
{
protected static function getFacadeAccessor()
{
return MyService::class;
}
}
// Usage
MyFacade::setResolvedInstance(new MyService());
MyFacade::someMethod();
use Effectra\Facade;
use Effectra\Container\Container;
class MyFacade extends Facade
{
protected static function getFacadeAccessor()
{
return 'myService';
}
}
// Usage
$container = new Container();
$container->bind('myService', MyService::class);
MyFacade::setContainer($container);
MyFacade::someMethod();