marko/database

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

Maintainers

Package info

github.com/marko-php/marko-database

pkg:composer/marko/database

Statistics

Installs: 207

Dependents: 10

Suggesters: 2

Stars: 0

0.5.0 2026-05-02 01:27 UTC

This package is auto-updated.

Last update: 2026-05-02 01:31:51 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