Usage
Table of contents
There are different ways of using this package which will be outlined further down. Choose whatever suits your needs better.
Using Inheritance
The most simple way to use the package is by extending the CreatableObject
class:
use NorseBlue\CreatableObjects\CreatableObject;
class MyObject extends CreatableObject
{
private function __construct() { }
}
Using Composition
If you prefer composition over inheritance, you can use the provided trait and interface instead:
use NorseBlue\CreatableObjects\Contracts\Creatable;
use NorseBlue\CreatableObjects\Traits\HandlesObjectCreation;
class MyObject implements Creatable
{
use HandlesObjectCreation;
private function __construct() { }
}