PHPackages                             squirrelphp/entities-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. squirrelphp/entities-bundle

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

squirrelphp/entities-bundle
===========================

Symfony integration of squirrelphp/entities - automatic integration of generated repositories for existing entities.

v0.15.1(5mo ago)13.3kMITPHPPHP &gt;=8.4CI failing

Since Apr 23Pushed 5mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (11)Versions (25)Used By (0)

Squirrel Entities Integration for Symfony
=========================================

[](#squirrel-entities-integration-for-symfony)

[![Build Status](https://camo.githubusercontent.com/7682930e4e5e6a9994822c095c7ac24291a1cfcf0fcb8cd198a4c2d4a3641541/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f737175697272656c7068702f656e7469746965732d62756e646c652e737667)](https://travis-ci.com/squirrelphp/entities-bundle) [![Test Coverage](https://camo.githubusercontent.com/262eee483a163eb51837ad981e964049377c888091becb7a3864efa5169665de/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f61313637336139303666356333333431323563312f746573745f636f766572616765)](https://codeclimate.com/github/squirrelphp/entities-bundle/test_coverage) [![PHPStan](https://camo.githubusercontent.com/65e2c93fbe63f94af93706ba48d15eafa85a0cd4ff0c5aeea712b4da080d7545/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374796c652d6c6576656c253230382d737563636573732e7376673f7374796c653d666c61742d726f756e64266c6162656c3d7068707374616e)](https://camo.githubusercontent.com/65e2c93fbe63f94af93706ba48d15eafa85a0cd4ff0c5aeea712b4da080d7545/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374796c652d6c6576656c253230382d737563636573732e7376673f7374796c653d666c61742d726f756e64266c6162656c3d7068707374616e) [![Packagist Version](https://camo.githubusercontent.com/fa65e0e65be9be7dbecc6930c8dae1f02f0a72239eef5a713434b17aa96686af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737175697272656c7068702f656e7469746965732d62756e646c652e7376673f7374796c653d666c61742d726f756e64)](https://packagist.org/packages/squirrelphp/entities-bundle) [![PHP Version](https://camo.githubusercontent.com/7168bb85d7dcb3ab731b2d78649226be98a06e3cbd122d3748399b9ecc13d676/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f737175697272656c7068702f656e7469746965732d62756e646c652e737667)](https://packagist.org/packages/squirrelphp/entities-bundle) [![Software License](https://camo.githubusercontent.com/4f9c8f8c009336d7177cf697d694e2e763e5e707f1a6224ab0d295465eadffbd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d737563636573732e7376673f7374796c653d666c61742d726f756e64)](LICENSE)

Integration of [squirrelphp/entities](https://github.com/squirrelphp/entities) into Symfony through bundle configuration, also needs [squirrelphp/queries-bundle](https://github.com/squirrelphp/queries-bundle) as a basis for connecting to databases and executing queries.

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

[](#installation)

```
composer require squirrelphp/entities-bundle

```

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

[](#configuration)

Enable the bundle in your Symfony configuration by adding `Squirrel\EntitiesBundle\SquirrelEntitiesBundle` to the list of bundles, and make sure to enable `Squirrel\QueriesBundle\SquirrelQueriesBundle` and configure connections through QueriesBundle, which is the basis for this bundle.

Configure the directories where the bundle will look for repositories like this in Symfony / YAML:

```
squirrel_entities:
    directories:
        - '%kernel.project_dir%/src'
        - '%kernel.project_dir%/possibleOtherDirectory'

```

It will go through these directories recusively, finding all entities, generating repositories and creating services for the repositories. The details on how to work with the repositories can be found in the documentation for the underlying library [squirrelphp/entities](https://github.com/squirrelphp/entities).

Overriding table names and connection names
-------------------------------------------

[](#overriding-table-names-and-connection-names)

If you are reusing entities from other projects and only want to change the connection name and/or the table name of an entity, you can override it through configuration:

```
squirrel_entities:
    connection_names:
        Application\Entity\User: 'postgres_connection'
        Application\Entity\Session: 'sqlite_connection'
    table_names:
        Application\Entity\User: 'differentdatabase.users'
        Application\Entity\Session: 'sessions_table'

```

This can also come in handy if you want to change connection names and table names for testing or development, while the attribute values are for the production system. Just use the fully qualified entity class name as the key. If you specify an empty string as connection name the default connection is used (if a default connection was defined through `QueriesBundle`).

Workflow with entities and repositories
---------------------------------------

[](#workflow-with-entities-and-repositories)

At this point you should have already configured [squirrelphp/queries-bundle](https://github.com/squirrelphp/queries-bundle) with your database(s).

### While developing

[](#while-developing)

1. Create entities with attributes as explained in [squirrelphp/entities](https://github.com/squirrelphp/entities)
2. Run `vendor/bin/squirrel_repositories_generate --source-dir=src` to generate the repositories for your entities - those will be gitignored (add or change the --source-dir entries depending on where your entities are)
3. Add the directories of your entities to the `squirrel_entities` configuration so repositories are found and initialized automatically when the Symfony service container is compiled.
4. Use the generated repository classes as type hints in your code and let Symfony autowire these services.
5. Add `vendor/bin/squirrel_repositories_generate --source-dir=src` to your composer.json in `scripts` for `post-install-cmd` and `post-update-cmd` (at the top of these lists). Whenever you do an install or update the repositories are recreated.

### In production

[](#in-production)

If you run `composer install` in production, just make sure you have added `squirrel_repositories_generate` to your composer.json as described in point number 5 in `While developing`, so every time you deploy the repositories are recreated.

If you have some specific deployment workflow, you can call `vendor/bin/squirrel_repositories_generate --source-dir=src` explicitely to generate the repositories. Just make sure you do it before the Symfony container is compiled (or before clearing it with cache:clear or cache:warmup), otherwise the repository classes will be missing and autowiring code with the repository classes will not work.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance70

Regular maintenance activity

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity77

Established project with proven stability

 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 ~104 days

Recently: every ~182 days

Total

24

Last Release

170d ago

PHP version history (6 changes)v0.2PHP ^7.2

v0.7PHP ^7.4

v0.9PHP &gt;=7.4

v0.12PHP &gt;=8.0

v0.14-RC1PHP &gt;=8.2

v0.15.1PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cd200dc74af2d77e8c480000a7e3bab0b8a98fae4b399d306b3d332354f8177?d=identicon)[iquito\_ch](/maintainers/iquito_ch)

---

Top Contributors

[![iquito](https://avatars.githubusercontent.com/u/973653?v=4)](https://github.com/iquito "iquito (32 commits)")

---

Tags

phpsymfonybundleabstractiondatabasemysqlsqlitepgsqlrepositoriesentities

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/squirrelphp-entities-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/squirrelphp-entities-bundle/health.svg)](https://phpackages.com/packages/squirrelphp-entities-bundle)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[kreait/firebase-bundle

Symfony Bundle for the Firebase Admin SDK

1534.7M2](/packages/kreait-firebase-bundle)[vcian/laravel-db-auditor

Database DB Auditor provide leverage to audit your MySql,sqlite, PostgreSQL database standards and also provide options to add constraints in table.

28535.1k1](/packages/vcian-laravel-db-auditor)

PHPackages © 2026

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