PHPackages                             minetro/ntdb - 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. minetro/ntdb

Abandoned → [contributte/database](/?search=contributte%2Fdatabase)ArchivedLibrary[Database &amp; ORM](/categories/database)

minetro/ntdb
============

Nette Database Nested Transaction

0.9.1(10y ago)512.3k1BSD-3-ClausePHPPHP &gt;= 5.6CI failing

Since Aug 28Pushed 5mo ago3 watchersCompare

[ Source](https://github.com/contributte/ntdb)[ Packagist](https://packagist.org/packages/minetro/ntdb)[ Docs](https://github.com/minetro/ntdb)[ RSS](/packages/minetro-ntdb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

[![](https://camo.githubusercontent.com/b55ee35e5210e2ba2ce39a09e51222943c35fd4d15b107cabafcc317d6392757/68747470733a2f2f686561746261646765722e76657263656c2e6170702f6769746875622f726561646d652f636f6e74726962757474652f6e7464622f3f646570726563617465643d31)](https://camo.githubusercontent.com/b55ee35e5210e2ba2ce39a09e51222943c35fd4d15b107cabafcc317d6392757/68747470733a2f2f686561746261646765722e76657263656c2e6170702f6769746875622f726561646d652f636f6e74726962757474652f6e7464622f3f646570726563617465643d31)

 [![](https://camo.githubusercontent.com/a8b1cd856d7d396fdebbe46947cc3507490acc267a02361e5e53bb7b820c95c3/68747470733a2f2f62616467656e2e6e65742f62616467652f737570706f72742f6769747465722f6379616e)](https://bit.ly/ctteg) [![](https://camo.githubusercontent.com/86d6416fc04f8bcc3daa7bf881526b9953b9726b1164d05c157c8713e3a73418/68747470733a2f2f62616467656e2e6e65742f62616467652f737570706f72742f666f72756d2f79656c6c6f77)](https://bit.ly/cttfo) [![](https://camo.githubusercontent.com/5d170ab94e6d594609561e16fe0f9e4293968fbd4dfcfafc5e11efc1415ef09c/68747470733a2f2f62616467656e2e6e65742f62616467652f73706f6e736f722f646f6e6174696f6e732f463936383534)](https://contributte.org/partners.html)

 Website 🚀 [contributte.org](https://contributte.org) | Contact 👨🏻‍💻 [f3l1x.io](https://f3l1x.io) | Twitter 🐦 [@contributte](https://twitter.com/contributte)

Disclaimer
----------

[](#disclaimer)

⚠️This project is no longer being maintained. Please use [contributte/database](https://github.com/contributte/database).Composer[`minetro/ntdb`](https://packagist.org/packages/minetro/ntdb)Version[![](https://camo.githubusercontent.com/4fcf13d675afddcae2a7ce574ba959a77ff00571bf4b0d678c9bf31511a183c5/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f6d696e6574726f2f6e746462)](https://camo.githubusercontent.com/4fcf13d675afddcae2a7ce574ba959a77ff00571bf4b0d678c9bf31511a183c5/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f6d696e6574726f2f6e746462)PHP[![](https://camo.githubusercontent.com/8d8e3b58d1299315705d2ba54a02f2967e428f7e2624b31f55f72e7901d710b8/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f7068702f6d696e6574726f2f6e746462)](https://camo.githubusercontent.com/8d8e3b58d1299315705d2ba54a02f2967e428f7e2624b31f55f72e7901d710b8/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f7068702f6d696e6574726f2f6e746462)License[![](https://camo.githubusercontent.com/a731b037641ffcfddba77e974e5ce84901a6ab9995fa5ae9098eb6ccab3fe542/68747470733a2f2f62616467656e2e6e65742f6769746875622f6c6963656e73652f636f6e74726962757474652f6e746462)](https://camo.githubusercontent.com/a731b037641ffcfddba77e974e5ce84901a6ab9995fa5ae9098eb6ccab3fe542/68747470733a2f2f62616467656e2e6e65742f6769746875622f6c6963656e73652f636f6e74726962757474652f6e746462)Resources
---------

[](#resources)

Inspired by these articles:

-
-
-

Usage
-----

[](#usage)

Provide nested transaction via savepoints.

**Support**

- MySQL / MySQLi
- PostgreSQL
- SQLite

**API**

- `$t->begin`
- `$t->commit`
- `$t->rollback`
- **`$t->transaction`** or **`$t->t`**
- `$t->promise`

### Begin

[](#begin)

Starts transaction.

```
$t = new Transaction(new Connection(...));
$t->begin();
```

### Commit

[](#commit)

Commit changes in transaction.

```
$t = new Transaction(new Connection(...));
$t->begin();
// some changes..
$t->commit();
```

### Rollback

[](#rollback)

Revert changes in transaction.

```
$t = new Transaction(new Connection(...));

$t->begin();
try {
	// some changes..
	$t->commit();
} catch (Exception $e) {
	$t->rollback();
}
```

### Transaction

[](#transaction)

Combine begin, commit and rollback to one method.

On success it commits changes, if exceptions is thrown it rollbacks changes.

```
$t = new Transaction(new Connection(...));

$t->transaction(function() {
	// some changes..
});

// or alias

$t->t(function() {
	// some changes..
});
```

### Promise

[](#promise)

Another attitude to transaction.

```
$t = new Transaction(new Connection(...));

$t->promise()->then(
	function() {
		// Logic.. (save/update/remove some data)
	},
	function () {
		// Success.. (after commit)
	},
	function() {
		// Failed.. (after rollback)
	}
);
```

### UnresolvedTransactionException

[](#unresolvedtransactionexception)

Log unresolved transaction.

Idea by Ondrej Mirtes ().

```
$t = new Transaction(new Connection(...));
$t->onUnresolved[] = function($exception) {
	Tracy\Debugger::log($exception);
};
```

Nette
-----

[](#nette)

### EXTENSION

[](#extension)

```
extensions:
	ntdb: Minetro\Database\Transaction\DI\Transaction
```

That's all. You can let nette\\di autowired it to your services/presenters.

### NEON

[](#neon)

Register as service in your config file.

```
services:
	- Minetro\Database\Transaction\Transaction
```

On multiple connections you have to specific one.

```
services:
	- Minetro\Database\Transaction\Transaction(@nette.database.one.connection)
	# or
	- Minetro\Database\Transaction\Transaction(@nette.database.two.connection)
```

### Repository | Presenter

[](#repository--presenter)

```
use Minetro\Database\Transaction\Transaction;

class MyRepository {

	function __construct(Connection $connection) {
		$this->transaction = new Transaction($connection);
	}

	// OR

	function __construct(Context $context) {
		$this->transaction = new Transaction($context->getConnection());
	}
}

class MyPresenter {

	public function processSomething() {
		$transaction->transaction(function() {
			// Save one..

			// Make other..

			// Delete from this..

			// Update everything..
		});
	}
}
```

Development
-----------

[](#development)

This package was maintain by these authors.

[ ![](https://avatars2.githubusercontent.com/u/538058?v=3&s=80)](https://github.com/f3l1x)---

Consider to [support](https://contributte.org/partners.html) **contributte** development team. Also thank you for using this package.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance49

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.2% 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 ~26 days

Total

2

Last Release

3890d ago

PHP version history (2 changes)0.9PHP &gt;= 5.5

0.9.1PHP &gt;= 5.6

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/538058?v=4)[Milan Šulc](/maintainers/f3l1x)[@f3l1x](https://github.com/f3l1x)

---

Top Contributors

[![f3l1x](https://avatars.githubusercontent.com/u/538058?v=4)](https://github.com/f3l1x "f3l1x (25 commits)")[![petrparolek](https://avatars.githubusercontent.com/u/6066243?v=4)](https://github.com/petrparolek "petrparolek (4 commits)")

---

Tags

contributtedatabasenette-frameworkphp

### Embed Badge

![Health badge](/badges/minetro-ntdb/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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