Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Latest commit

 

History

History
39 lines (29 loc) · 1021 Bytes

README.md

File metadata and controls

39 lines (29 loc) · 1021 Bytes

BuilderTrait (WIP) Build Status

If you want to create a builder but you don't want to duplicate or write with... methods. BuilderTrait\With create automatically with... method based on property of the builder object.

Example

class AnObjectBuilder
{
    use With;

    private $foo;

    public function buildAnObject()
    {
        return new AnObject($this->foo);
    }
}

$builder = new AnObjectBuilder();
$anObject = $builder->withFoo('bar')->buildAnObject();

##TODO

  • With trait for add with... methods based on builder properties
  • Build trait for create build method based on getter/setter of object to create

Install

composer require edelprino/buildertrait

Resources on Builder pattern

Follow me on