PHPackages                             tourze/symfony-aop-doctrine-bundle - 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. tourze/symfony-aop-doctrine-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

tourze/symfony-aop-doctrine-bundle
==================================

Doctrine enhance

1.0.1(6mo ago)01.4k7MITPHPCI passing

Since Apr 8Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/symfony-aop-doctrine-bundle)[ Packagist](https://packagist.org/packages/tourze/symfony-aop-doctrine-bundle)[ RSS](/packages/tourze-symfony-aop-doctrine-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (18)Versions (5)Used By (7)

Symfony AOP Doctrine Bundle
===========================

[](#symfony-aop-doctrine-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/862658f64c400a7407db3639bbd19981a7c4fbb0c1e812a2686f10e031e98b06/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f73796d666f6e792d616f702d646f637472696e652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/symfony-aop-doctrine-bundle)[![Build Status](https://camo.githubusercontent.com/c82e8a06638e1dc30f3c84301c5e5f96df3008d3a815258440d49042b8578943/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f75727a652f73796d666f6e792d616f702d646f637472696e652d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tourze/symfony-aop-doctrine-bundle)[![Quality Score](https://camo.githubusercontent.com/3ad781a4bcd20501c869c17ecee38634266505cb8ba017ec9ba308edf20dd31d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f73796d666f6e792d616f702d646f637472696e652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/symfony-aop-doctrine-bundle)[![Total Downloads](https://camo.githubusercontent.com/07ecb2ad1541ac08f22bd98a4961dac772a3c9a11a11c6d83c071444813b5d57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f73796d666f6e792d616f702d646f637472696e652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/symfony-aop-doctrine-bundle)[![PHP Version](https://camo.githubusercontent.com/523380665cd608b68076e509e4d7c0e3579836ce7d5908becf2e7a59d425fd10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f73796d666f6e792d616f702d646f637472696e652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/symfony-aop-doctrine-bundle)[![License](https://camo.githubusercontent.com/d739005560ef197e0416a4e6f6f0690c9ed7bcd61deae0c7d01e908c46e99752/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f73796d666f6e792d616f702d646f637472696e652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/symfony-aop-doctrine-bundle)[![Code Coverage](https://camo.githubusercontent.com/e02ac401f6b98776771eef0a09d7f3a098bca7d800d95e38bcb66755597d82d4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f75727a652f73796d666f6e792d616f702d646f637472696e652d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/symfony-aop-doctrine-bundle/?branch=master)

A Symfony bundle that enhances Doctrine ORM with declarative transaction management via AOP (Aspect-Oriented Programming), inspired by the design of Spring Boot.

Features
--------

[](#features)

- Declarative transaction support with `#[Transactional]` attribute
- Automatic transaction begin/commit/rollback
- Nested transaction and transaction propagation
- Detailed transaction logging
- Smart transaction reuse and performance optimization

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

[](#installation)

```
composer require tourze/symfony-aop-doctrine-bundle
```

Quick Start
-----------

[](#quick-start)

```
use Tourze\Symfony\AopDoctrineBundle\Attribute\Transactional;

class YourService
{
    #[Transactional]
    public function doSomething()
    {
        $this->entityManager->persist($entity);
        $this->entityManager->flush();
        // If an exception is thrown, the transaction will be rolled back automatically.
        // If completed normally, the transaction will be committed automatically.
    }
}
```

### Nested Transactions

[](#nested-transactions)

```
class YourService
{
    #[Transactional]
    public function outerMethod()
    {
        $this->innerMethod();
        // The transaction is committed here.
    }

    #[Transactional]
    public function innerMethod()
    {
        // This method reuses the outer transaction, no new transaction is created.
    }
}
```

### Transaction Logging

[](#transaction-logging)

```
use Psr\Log\LoggerInterface;

class YourService
{
    public function __construct(private LoggerInterface $logger) {}

    #[Transactional]
    public function doSomething()
    {
        // Transaction start and end will be automatically logged.
        $this->entityManager->persist($entity);
        $this->entityManager->flush();
    }
}
```

Notes
-----

[](#notes)

- The `#[Transactional]` attribute can only be applied to public methods.
- Nested transactions are automatically reused.
- Any exception thrown in a transactional method will cause a rollback.
- Make sure to use the correct EntityManager inside transactional methods.
- Avoid long-running transactions and non-DB operations inside transactions.
- Distributed and cross-database transactions are not supported.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance71

Regular maintenance activity

Popularity14

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~69 days

Total

4

Last Release

192d ago

Major Versions

0.0.2 → 1.0.02025-11-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-symfony-aop-doctrine-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-symfony-aop-doctrine-bundle/health.svg)](https://phpackages.com/packages/tourze-symfony-aop-doctrine-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

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