PHPackages                             roukmoute/doctrine-prefix-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. roukmoute/doctrine-prefix-bundle

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

roukmoute/doctrine-prefix-bundle
================================

Listener that prefixes tables and sequences

v2.0.0(3mo ago)319.4k1MITPHPPHP ^8.1CI passing

Since Oct 28Pushed 3mo ago1 watchersCompare

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

READMEChangelog (6)Dependencies (8)Versions (10)Used By (0)

DoctrinePrefixBundle
====================

[](#doctrineprefixbundle)

[![CI](https://github.com/roukmoute/DoctrinePrefixBundle/actions/workflows/ci.yml/badge.svg)](https://github.com/roukmoute/DoctrinePrefixBundle/actions/workflows/ci.yml)

A Symfony bundle that automatically prefixes Doctrine ORM table names, indexes, unique constraints, and PostgreSQL sequences.

Prefixes are useful when you need to:

- Share a database with tables from another project
- Use reserved SQL keywords as entity names (like `user` or `group`)
- Organize tables by application or module

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

[](#requirements)

- PHP ^8.1
- Symfony ^6.4 || ^7.0
- Doctrine ORM ^3.0

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

[](#installation)

```
composer require roukmoute/doctrine-prefix-bundle
```

With Symfony Flex, the bundle is automatically registered.

Configuration
-------------

[](#configuration)

```
# config/packages/roukmoute_doctrine_prefix.yaml
roukmoute_doctrine_prefix:
    prefix: 'app_'
```

### Options

[](#options)

OptionTypeDefaultDescription`prefix`string`''`The prefix to prepend to names`bundles`array`[]`If set, only entities from these namespaces will be prefixed`encoding`string`'UTF-8'`The encoding for the prefix### Example with bundle filtering

[](#example-with-bundle-filtering)

```
roukmoute_doctrine_prefix:
    prefix: 'app_'
    bundles:
        - 'App\Entity'
        - 'Acme\BlogBundle\Entity'
```

What gets prefixed?
-------------------

[](#what-gets-prefixed)

ElementExample (prefix: `app_`)Table names`user` → `app_user`Index names`idx_email` → `app_idx_email`Unique constraint names`uniq_email` → `app_uniq_email`Many-to-many join tables`user_role` → `app_user_role`PostgreSQL sequences`user_id_seq` → `app_user_id_seq`Example
-------

[](#example)

```
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(
    indexes: [new ORM\Index(name: 'idx_email', columns: ['email'])],
    uniqueConstraints: [new ORM\UniqueConstraint(name: 'uniq_username', columns: ['username'])]
)]
class User
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(length: 180)]
    private ?string $email = null;

    #[ORM\Column(length: 50)]
    private ?string $username = null;

    #[ORM\ManyToMany(targetEntity: Role::class)]
    private Collection $roles;
}
```

With `prefix: 'app_'`, this will generate:

- Table: `app_user`
- Index: `app_idx_email`
- Unique constraint: `app_uniq_username`
- Join table: `app_user_role`

License
-------

[](#license)

MIT

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance78

Regular maintenance activity

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 94.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 ~820 days

Recently: every ~962 days

Total

6

Last Release

116d ago

Major Versions

v0.9 → v1.02020-01-14

v1.0.2 → v2.0.02026-01-20

### Community

Maintainers

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

---

Top Contributors

[![roukmoute](https://avatars.githubusercontent.com/u/2140469?v=4)](https://github.com/roukmoute "roukmoute (16 commits)")[![RoukTest](https://avatars.githubusercontent.com/u/31143252?v=4)](https://github.com/RoukTest "RoukTest (1 commits)")

---

Tags

doctrine2phpsymfony-bundle

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/roukmoute-doctrine-prefix-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[pixelfederation/doctrine-resettable-em-bundle

Symfony bundle for decorating default entity managers using a resettable decorator.

20113.5k](/packages/pixelfederation-doctrine-resettable-em-bundle)[bartlett/php-compatinfo-db

Reference Database of all functions, constants, classes, interfaces on PHP standard distribution and about 110 extensions

1183.0k1](/packages/bartlett-php-compatinfo-db)

PHPackages © 2026

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