PHPackages                             xruff/basedbmodel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. xruff/basedbmodel

ActiveLibrary[Database &amp; ORM](/categories/database)

xruff/basedbmodel
=================

Nette database utility

v2.0.2(6y ago)062713BSD-3-ClausePHP

Since Apr 28Pushed 6y ago2 watchersCompare

[ Source](https://github.com/XRuff/BaseDbModel)[ Packagist](https://packagist.org/packages/xruff/basedbmodel)[ RSS](/packages/xruff-basedbmodel/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (7)Versions (7)Used By (3)

Nette database utility
======================

[](#nette-database-utility)

Requirements
------------

[](#requirements)

Package requires PHP 5.6 or higher

- [nette/database](https://github.com/nette/security)
- [nette/utils](https://github.com/nette/application)

Installation
------------

[](#installation)

The best way to install XRuff/BaseDbModel is using [Composer](http://getcomposer.org/):

```
$ composer require xruff/basedbmodel
```

Short Documentation
-------------------

[](#short-documentation)

UsersRepository for handling database table `users`. You should use `Repository` suffix after table name.

```
namespace MyModels;

use XRuff\App\Model\BaseDbModel;

class UsersRepository extends BaseDbModel
{
	// no implementation needed
}
```

If for some reason you can not use the table name or word Repository in class name, follow these steps:

```
namespace MyModels;

use Nette\Database\Context;
use XRuff\App\Model\BaseDbModel;

class MyAnyNameRepo extends BaseDbModel
{
	public function __construct(Context $db)
	{
		parent::__construct($db, 'my_db_able_name');
	}
}
```

Using model in presenter (or anywhere else):

```
use Nette;
use MyModels\UsersRepository;

class MyUsersPresenter extends Nette\Application\UI\Presenter
{
	/** @var UsersRepository $usersModel */
	public $usersModel;

	public function __construct(
		UsersRepository $usersModel
	) {
		$this->usersModel = $usersModel;
	}

	public function actionDefault()
	{
		// returns Nette\Database\Table\ActiveRow
		// with first user with name John in table users
		$this->usersModel->getOneBy(['name' => 'John']);

		// or
		// set name as Joe for user with id 5 in table users
		// and returns Nette\Database\Table\ActiveRow with updated values
		$this->usersModel->save(['id' => 5, 'name' => 'Joe']);

		// or add new user with name Jane
		// and returns Nette\Database\Table\ActiveRow with just added row
		$this->usersModel->save(['name' => 'Jane']);

		// or some another method inherited from BaseDbModel
	}
}
```

---

Repository .

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~217 days

Recently: every ~271 days

Total

6

Last Release

2256d ago

Major Versions

v1.0.1 → v2.0.02018-02-14

v2.0.2 → v3.0.x-dev2020-04-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/2eadb96b627cd99367bb565aa4c6058b276146ec587a6ea9f81b1ce1642dca3c?d=identicon)[xruff](/maintainers/xruff)

---

Top Contributors

[![XRuff](https://avatars.githubusercontent.com/u/10323314?v=4)](https://github.com/XRuff "XRuff (4 commits)")[![pavellauko](https://avatars.githubusercontent.com/u/861888?v=4)](https://github.com/pavellauko "pavellauko (2 commits)")[![mlazovla](https://avatars.githubusercontent.com/u/2652944?v=4)](https://github.com/mlazovla "mlazovla (1 commits)")

---

Tags

nettenette-frameworkgooglenettecomponentanalyticsga

### Embed Badge

![Health badge](/badges/xruff-basedbmodel/health.svg)

```
[![Health](https://phpackages.com/badges/xruff-basedbmodel/health.svg)](https://phpackages.com/packages/xruff-basedbmodel)
```

###  Alternatives

[nette/caching

⏱ Nette Caching: library with easy-to-use API and many cache backends.

43619.1M391](/packages/nette-caching)[nette/database

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5436.9M255](/packages/nette-database)[ublaboo/datagrid

DataGrid for Nette Framework: filtering, sorting, pagination, tree view, table view, translator, etc

2972.0M24](/packages/ublaboo-datagrid)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136400.8k14](/packages/rector-rector-src)[kdyby/doctrine

Doctrine integration into Nette Framework

1091.0M86](/packages/kdyby-doctrine)[contributte/monolog

Monolog integration into Nette Framework

242.0M7](/packages/contributte-monolog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
