1. Go to this page and download the library: Download sugatasei/bredala-data 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/ */
sugatasei / bredala-data example snippets
use Bredala\Data\ModelAbstract;
class User extends ModelAbstract
{
public ?int $id = null;
public string $email = '';
public string $name = '';
}
class Post extends ModelAbstract
{
public string $slug = '';
public string $createdAt = '';
public function init(): static
{
$this->createdAt = date('Y-m-d H:i:s');
return $this;
}
}
$editable = ['email', 'name']; // ni id, ni role
$user->import(array_intersect_key($input, array_flip($editable)));