1. Go to this page and download the library: Download szogyenyid/php-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/ */
szogyenyid / php-builder example snippets
class User
{
private string $name;
private string $email;
public function setName(string $newName): void
{
$this->name = $newName;
}
public function setEmail(string $newEmail): void
{
$this->email = $newEmail;
}
}
$user = new User();
$user->setName("John Doe");
$user->setEmail("[email protected]");
class User
{
use Builder;
private string $name;
private string $email;
}
$user = User::builder()
->withName("John Doe")
->withEmail("[email protected]")
->build();
class User
{
use Builder;
//...
}
class User
{
use Builder;
private string $name;
private string $email;
}