composer require proteins/extensions
Include the trait in your classes via :
use Proteins\Extensions;
class Test {
use Extensions;
}
class Test {
use Extensions;
public static function foo(){ echo "Foo!"; }
}
Test::foo(); // Foo!
Test::bar(); // Fatal error: Call to undefined method Test::bar
Test::extend([
'bar' => function(){ echo "Bar!"; },
]);
Test::bar(); // Bar!