PHPackages                             creof/doctrine2-namespace-namingstrategy - 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. creof/doctrine2-namespace-namingstrategy

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

creof/doctrine2-namespace-namingstrategy
========================================

Doctrine2 naming strategy incorporating class namespace into names

1231PHP

Since Nov 6Pushed 12y ago1 watchersCompare

[ Source](https://github.com/creof/doctrine2-namespace-namingstrategy)[ Packagist](https://packagist.org/packages/creof/doctrine2-namespace-namingstrategy)[ RSS](/packages/creof-doctrine2-namespace-namingstrategy/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

doctrine2-namespace-namingstrategy
==================================

[](#doctrine2-namespace-namingstrategy)

Highly configurable Doctrine2 naming strategy incorporating class namespace into names. This class generates names in a predictable fashion, eliminating the need to take database schema into account when naming objects. This is especially useful when dealing with large hierarchical entity graphs with class name duplication.

Installion
----------

[](#installion)

### composer

[](#composer)

Add the "creof/doctrine2-namespace-namingstrategy" package into your composer.json file.

### Other

[](#other)

Usage
-----

[](#usage)

### Doctrine

[](#doctrine)

To use the naming scheme a new instance will need to be created and passed to the entity manager configuration object.

### Symfony

[](#symfony)

Create a service in your app config and pass the service to the Doctrine entity manager:

```
# Doctrine Configuration
doctrine:
    orm:
        naming_strategy: namespace_naming_strategy

services:
    namespace_naming_strategy:
        class: CrEOF\Doctrine\ORM\Mapping\NamespaceNamingStrategy
        arguments:
            config:
                entityNamespaces:
                    - "Acme\Bundle\AcmeBundle"
                trimAbstract: true

```

To use the class constants you'll need to define the service in XML or lookup the integer values in the code.

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

[](#configuration)

The NamespaceNamingStrategy constructor accepts an array containing one or more of the following options:

- trimAbstract - Remove "Abstract" from all class names beginning with it. Default false.
- entityNamespaces - Array containing the root(s) of entity classes. These roots will be removed from generated names.
- namespaceSeparator - String used to separate namespace path components when generating names. Default is "\_" (underscore).
- joinColumnSeparator - String used to separate the reference column name from the property name. Default is "" (empty).
- joinTableSeparator - String used to separate entity names when generating join table names. Default is "\_" (underscore).
- trimFallback - One of the two FALLBACK class constants. This setting defines the behavior when no matching namespace in entityNamespaces can be found for a class.
- case - One of the three CASE class constants. This setting defines whether names are generated in mixed, lower, or upper case.
- referenceColumnName - This defines the name used/concatenated when generating reference column names. Default is "id".
- joinColumnOrder - One of the two ORDER class constants. This defines whether the reference column name is prepended or appended to the entity name.
- joinTableOrder - same as joinColumnOrder but for join tables.
- splitCamelCase - Use in conjunction with camelCaseSeparator. When true camel cased names will be split using the separator. Default false.
- camelCaseSeparator - String used to split camel cased words when splitCamelCase is true. Default is "" (empty).

Caveats
-------

[](#caveats)

This is a work-in-progress and probably not production ready. Use at your own risk.

###  Health Score

21

—

LowBetter than 17% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1187338?v=4)[Derek J. Lambert](/maintainers/djlambert)[@djlambert](https://github.com/djlambert)

---

Top Contributors

[![djlambert](https://avatars.githubusercontent.com/u/1187338?v=4)](https://github.com/djlambert "djlambert (15 commits)")

### Embed Badge

![Health badge](/badges/creof-doctrine2-namespace-namingstrategy/health.svg)

```
[![Health](https://phpackages.com/badges/creof-doctrine2-namespace-namingstrategy/health.svg)](https://phpackages.com/packages/creof-doctrine2-namespace-namingstrategy)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.8k117.8M121](/packages/jdorn-sql-formatter)[backup-manager/backup-manager

A framework agnostic database backup manager with user-definable procedures and support for S3, Dropbox, FTP, SFTP, and more with drivers for popular frameworks.

1.7k1.6M11](/packages/backup-manager-backup-manager)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M88](/packages/propel-propel1)[insolita/yii2-migration-generator

Set of gii tools for generating files for migration by schema of table , phpdoc or table data

108508.0k5](/packages/insolita-yii2-migration-generator)[xpdo/xpdo

A PDO-based Object/Relational Bridge Library

7088.4k4](/packages/xpdo-xpdo)[voku/session2db

A PHP library acting as a wrapper for PHP's default session handling functions which stores data in a MySQL database, providing both better performance and better security and protection against session fixation and session hijacking.

2920.0k](/packages/voku-session2db)

PHPackages © 2026

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