Search by

marko / database

markshust

Marko Framework Database Layer - Entity-driven schema with Data Mapper pattern

Package info

github.com/marko-php/marko-database

pkg:composer/marko/database

Statistics

Installs: 865

Dependents: 16

Suggesters: 3

Stars: 0

0.11.0 2026-10-06 15:16 UTC

README

Entity-driven schema definition with the Data Mapper pattern for the Marko framework.

Installation

composer require marko/database

You typically install a driver package (like marko/database-pgsql) which requires this automatically.

Quick Example

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;
}

Documentation

Full usage, API reference, and examples: marko/database