PHP code example of jasonej / bootable-traits
1. Go to this page and download the library: Download jasonej/bootable-traits 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/ */
jasonej / bootable-traits example snippets
use Jasonej\BootableTraits\BootsTraits;
trait ExampleTrait
{
public $booted = false;
public function bootExampleTrait(): void
{
$this->booted = true;
}
}
class ExampleClass
{
use BootsTraits;
use ExampleTrait;
public function __construct()
{
static::bootTraits($this);
}
}
use Jasonej\BootableTraits\BootsTraits;
trait ExampleTrait
{
public static $booted = false;
public static function bootExampleTrait(): void
{
static::$booted = true;
}
}
class ExampleClass
{
use BootsTraits;
use ExampleTrait;
public static function init()
{
static::bootTraits();
}
}