Search by

varhall / dbino

feropeterko

Nette Database Active Record Layer

Package info

github.com/varhall/dbino

pkg:composer/varhall/dbino

Statistics

Installs: 605

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

v2.0.8 2026-05-20 16:25 UTC

README

Dbino is an Active Record layer for Nette Database. Every table gets a model class you query and save through, with attribute casting, events, scopes, relations and ready-made behaviours on top of Nette Database Explorer.

$author = Author::find(1);
$author->name = 'Johann';
$author->save();

$books = $author->books->where('available', true)->order('title');

Features

  • Models: reading and writing attributes, saving, deleting, duplicating, scopes, timestamps, soft deletes
  • Queries: lazy collections with all Nette Selection methods, repositories with custom query methods
  • Relations: one-to-many, one-to-one, belongs-to and many-to-many with attach / detach / sync
  • Mutators & casting: accessors, mutators, built-in and custom casts, JSON, UUID, password hashing, serialization
  • Events: model and repository lifecycle events
  • Tree nodes: nested set hierarchies
  • Dependency injection & testing: inject repositories into services and test them without a database

Installation

composer require varhall/dbino

Register the extension next to your database configuration:

extensions:
    dbino: Varhall\Dbino\DI\DbinoExtension

Then define a model:

use Varhall\Dbino\Model;

class Author extends Model
{
    protected function table()
    {
        return 'authors';
    }
}

See the documentation for everything else.

Versions

State Version Branch Nette Database PHP
stable ^1.0 v1.0 3.1 8.0+
stable ^2.0 v2.0 3.2+ 8.1+

Development

The tests are written for Nette Tester and run against a real MySQL / MariaDB server. Each test creates and drops its own database, so the configured user needs the rights to do that.

composer install
DATABASE_DSN='mysql:host=127.0.0.1' DATABASE_USER=root DATABASE_PASSWORD=secret make tests

Run a single file with make tests FILE=Model/RepositoryTest.phpt, or generate a coverage report with make coverage. CI runs the suite on PHP 8.1–8.5 with MariaDB, see .github/workflows/tests.yml.

Maintainers

Thank you for using this package.