jasonej / bootable-traits
Quickly and easily enable booting of traits in any class.
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/jasonej/bootable-traits
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2025-09-14 14:52:49 UTC
README
A simple package for enabling the booting of traits.
Installation
composer require jasonej/bootable-traits
Usage
<?php 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); } }
<?php 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(); } }