PHP code example of nayjest / builder
1. Go to this page and download the library: Download nayjest/builder 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/ */
nayjest / builder example snippets
use Nayjest\Builder\Blueprint;
$blueprint = new Blueprint(
'\My\ExamplePackage\Person', # Constructed class name
[] # Array of build instructions
);
use Nayjest\Builder\Builder;
$builder = new Builder($blueprint);
$john = $builder->build([
'name' => 'John',
'age' => 27
]);
var_dump($john instanceof \My\ExamplePackage\Person); // result: true
var_dump($john->getAge()); // result: 27