PHP code example of marko / database
1. Go to this page and download the library: Download marko/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/ */
marko / database example snippets
use Marko\Database\Attributes\Column;
use Marko\Database\Attributes\Table;
use Marko\Database\Entity\Entity;
use Marko\Database\Repository\Repository;
#[Table('posts')]
class Post extends Entity
{
#[Column(primaryKey: true, autoIncrement: true)]
public int $id;
#[Column(length: 255)]
public string $title;
#[Column(type: 'json')]
public array $metadata = [];
}
class PostRepository extends Repository
{
protected const string ENTITY_CLASS = Post::class;
}