PHP code example of bapcat / facade

1. Go to this page and download the library: Download bapcat/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/ */

    

bapcat / facade example snippets


namespace Vendor\Package\Logging;

class Logger {
  public function warning($text) {
    // ...
  }
}

$logger = new Vendor\Package\Logging\Logger;

$phi = BapCat\Phi\Phi::instance();
$phi->bind('core.log', $logger);

use BapCat\Facade\Facade;

class Log extends Facade {
  protected static $_binding = 'core.log';
}

Log::warning('Something bad happened!');

$phi = BapCat\Phi\Phi::instance();
$phi->bind('phi', $phi);

use BapCat\Facade\Facade;

class Phi extends Facade {
  protected static $_binding = 'phi';
}

Phi::bind('Bar', 'Foo');
$foo = Phi::make('Bar');