1. Go to this page and download the library: Download drago-ex/database 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/ */
class SampleEntity extends Drago\Database\Entity
{
public const Table = 'table';
public const PrimaryKey = 'id';
public ?int $id = null;
public string $sample;
}
#[Table(SampleEntity::Table, SampleEntity::PrimarKey)]
class Repository {}
function find(int $id): array|SampleEntity|null
{
return $this->get($id)->fetch();
}