PHPackages                             szykra/resource-naming-strategy - 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. szykra/resource-naming-strategy

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

szykra/resource-naming-strategy
===============================

Resource Naming Strategy for Doctrine ORM

0.1.4(5y ago)424.6k↓29.9%1MITPHP

Since Apr 30Pushed 5y ago2 watchersCompare

[ Source](https://github.com/skrajewski/resource-naming-strategy)[ Packagist](https://packagist.org/packages/szykra/resource-naming-strategy)[ RSS](/packages/szykra-resource-naming-strategy/feed)WikiDiscussions master Synced 3d ago

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

Resource Naming Strategy
========================

[](#resource-naming-strategy)

[![building](https://camo.githubusercontent.com/fdf93cac6895ef272200d0042abef9652993cf2719a3510c76840e299a28c1d2/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f736b72616a6577736b692f7265736f757263652d6e616d696e672d73747261746567792e737667)](https://travis-ci.org/skrajewski/resource-naming-strategy)[![codeclimate](https://camo.githubusercontent.com/8e595ce7e002171a0b8da96750c22c9156dd425e273fd869bdf3c635c5a1e72f/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f6d61696e7461696e6162696c6974792f736b72616a6577736b692f7265736f757263652d6e616d696e672d7374726174656779)](https://codeclimate.com/github/skrajewski/resource-naming-strategy)[![version](https://camo.githubusercontent.com/6b04055c0ee8e45cb06d95a1a2f543f8d81c3ee4593a0bd446a6be5154bfd153/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737a796b72612f7265736f757263652d6e616d696e672d73747261746567792e737667)](https://packagist.org/packages/szykra/resource-naming-strategy)[![license](https://camo.githubusercontent.com/1154811971e6deb9f28438feac4ba60e22aadabab26928d8e6bce4a37696abd1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f737a796b72612f7265736f757263652d6e616d696e672d73747261746567792e737667)](https://packagist.org/packages/szykra/resource-naming-strategy)

Resource Naming Strategy for Doctrine ORM

Why *Resource*?
---------------

[](#why-resource)

This naming strategy following the natural way of thinking about *entities* and *resources*. Imagine that you have **one Flower**. It's single entity. You want to store some data about **flowers** e.g. in your database. It's *resource*.

Simple? I know resource named *flower* sounds easier but sometimes it's more confusing. In the end, you have a lot of flowers, not one.

This strategy is similar to the *Laravel* naming convention (See [mapping](#mapping) section).

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

[](#requirements)

This package uses `icanboogie/inflector` and it requires a **mbstring** php extension.

Instalation
-----------

[](#instalation)

### Install via composer

[](#install-via-composer)

Add dependecy to your `composer.json` file and run `composer update`.

```
"require": {
    "szykra/resource-naming-strategy": "~0.1"
}
```

Usage
-----

[](#usage)

### Usage with Doctrine

[](#usage-with-doctrine)

```
$namingStrategy = new \Szykra\NamingStrategy\ResourceNamingStrategy();
$configuration()->setNamingStrategy($namingStrategy);
```

### Usage with Symfony

[](#usage-with-symfony)

You have a two ways to use this naming strategy

#### Register bundle in `AppKernel.php`

[](#register-bundle-in-appkernelphp)

Just open your `AppKernel.php` file and register new symfony bundle which contains a service definition.

```
$bundles = array(
    ...
    new Szykra\NamingStrategy\ResourceNamingBundle\ResourceNamingBundle()
);
```

Now you can configure Doctrine in `config.yml` to use new naming strategy.

```
doctrine:
    orm:
        naming_strategy: szykra.naming_strategy.resource_naming_strategy
```

### Define your own service

[](#define-your-own-service)

If you don't want to register additional bundles you can create own service definiton in `services.yml`:

```
services:
    app.naming_strategy.resource:
        class: Szykra\NamingStrategy\ResourceNamingStrategy
```

And don't forget to configure Doctrine to use this service.

Mapping
-------

[](#mapping)

### Entity to table name

[](#entity-to-table-name)

Lowercase and plural

EntityTableUserusersCategorycategoriesTaskActivitytask\_activities### Property to column name

[](#property-to-column-name)

Lowercase letters and words separated by the underscore

PropertyColumnfirstNamefirst\_nameLastNamelast\_namesecondRememberTokensecond\_remember\_token### Embedded field to column name

[](#embedded-field-to-column-name)

Lowercase letters and words separated by the underscore

Property from embedded `Address`Columnstreetaddress\_streetpostcodeaddress\_postcodeaddressLineOneaddress\_address\_line\_one### Join column name

[](#join-column-name)

Lowercase letters and words separated by the underscore with *\_id* suffix

PropertyColumnreporterreporter\_idtask\_activitytask\_activity\_id### Join table name

[](#join-table-name)

Two singular lowercase entity names in ascending order with words separated by the underscore

Entity 1Entity 2TableUserTasktask\_userCommentPostcomment\_postWorkTimeLogtime\_log\_workLicense
-------

[](#license)

The MIT License. Copyright © 2015 - 2020 Szymon Krajewski.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.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 ~495 days

Total

5

Last Release

2103d ago

### Community

Maintainers

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

---

Top Contributors

[![skrajewski](https://avatars.githubusercontent.com/u/4791560?v=4)](https://github.com/skrajewski "skrajewski (16 commits)")[![danaki](https://avatars.githubusercontent.com/u/1043805?v=4)](https://github.com/danaki "danaki (2 commits)")[![grizzlylab](https://avatars.githubusercontent.com/u/2612537?v=4)](https://github.com/grizzlylab "grizzlylab (1 commits)")

---

Tags

doctrinephpsymfonyormdoctrineresourcestrategynaming

### Embed Badge

![Health badge](/badges/szykra-resource-naming-strategy/health.svg)

```
[![Health](https://phpackages.com/badges/szykra-resource-naming-strategy/health.svg)](https://phpackages.com/packages/szykra-resource-naming-strategy)
```

###  Alternatives

[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46118.2M166](/packages/sonata-project-doctrine-orm-admin-bundle)[api-platform/doctrine-orm

Doctrine ORM bridge

294.4M92](/packages/api-platform-doctrine-orm)[goodwix/doctrine-json-odm

JSON Object-Document Mapping bundle for Symfony and Doctrine

2226.9k](/packages/goodwix-doctrine-json-odm)

PHPackages © 2026

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