1. Go to this page and download the library: Download kabunx/hydrate 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/ */
kabunx / hydrate example snippets
declare(strict_types=1);
namespace App\Entities;
use Carbon\Carbon;
use Kabunx\Hydrate\Entity;
use Kabunx\Hydrate\Column;
/**
* Class UserEntity
* @package App\Entities
*/
class UserEntity extends Entity
{
public string $name = '';
public string $email = '';
public int $gender = 0;
public string $birthday = '';
public ?Carbon $createdAt;
#[Column(source: "modifiedAt")]
public ?Carbon $updatedAt;
/**
* @param string $value
* @return int
*/
public function setGender(string $value): int
{
return $value == 'm' ? 0 : 1;
}
}