PHPackages                             itemvirtual/laravel-doctrine - 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. [CLI &amp; Console](/categories/cli)
4. /
5. itemvirtual/laravel-doctrine

ActiveLibrary[CLI &amp; Console](/categories/cli)

itemvirtual/laravel-doctrine
============================

Doctrine Console Commands for Laravel framework

1.0.6(3y ago)0258MITPHPPHP ^7.1 || ^8.0

Since Apr 21Pushed 3y ago2 watchersCompare

[ Source](https://github.com/itemvirtual/laravel-doctrine)[ Packagist](https://packagist.org/packages/itemvirtual/laravel-doctrine)[ Docs](https://github.com/itemvirtual/laravel-doctrine)[ RSS](/packages/itemvirtual-laravel-doctrine/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)Dependencies (5)Versions (8)Used By (0)

Laravel Doctrine
================

[](#laravel-doctrine)

[![Latest Version on Packagist](https://camo.githubusercontent.com/84524c7bd7ab76b3e0f995614ad2403913ee25c55e3bd3803d9326c1b96d8026/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6974656d7669727475616c2f6c61726176656c2d646f637472696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/itemvirtual/laravel-doctrine)[![Total Downloads](https://camo.githubusercontent.com/263feb8e81e9161acaec00152108e6b5078f5e5bc194aa4a7e8262590d2fd35b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6974656d7669727475616c2f6c61726176656c2d646f637472696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/itemvirtual/laravel-doctrine)

Doctrine Console Commands for Laravel framework.
This package is just to keep your database in sync (instead of migrations).
Update, validate and generate xml-mappings from the database.

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

[](#installation)

You can install the package via composer:

```
composer require itemvirtual/laravel-doctrine
```

In order to edit the default configuration you may execute: (with `--force` option to update)

```
php artisan vendor:publish --provider="Itemvirtual\LaravelDoctrine\LaravelDoctrineServiceProvider" --tag=config
```

Laravel comes with some predefined migrations, you can put them in place with this publish

```
php artisan vendor:publish --provider="Itemvirtual\LaravelDoctrine\LaravelDoctrineServiceProvider" --tag=laravel_default_migrations
```

Usage
-----

[](#usage)

#### · Generate xml-mappings from database

[](#-generate-xml-mappings-from-database)

> This command is only useful when you have an existing database, It should not be necessary for you to call this method multiple times

You can provide the destination path where the generated files will be saved.
You also have the option to only generate the mappings for certain tables.

```
php artisan doctrine:generate-mappings [--path=destination/path/to/xml-mappings] [--table=]+
php artisan doctrine:generate-mappings --path=database/doctrine/xml-mappings --table=ursers --table=password_resets
```

Options:

```
  --path[=PATH]     The path where your xml-mapping files will be generated
  --table[=TABLE]   The database tables to be generated (multiple values allowed)

```

#### · Validate mappings and database

[](#-validate-mappings-and-database)

Check if the associations are defined correctly, and their mappings are in sync with the database.
You can remove all your entities before perform validating.

```
php artisan doctrine:validate [-R | --remove-entities]
```

Options:

```
  -R, --remove-entities  Delete current entities before generating new ones

```

#### · Update database

[](#-update-database)

Run the queries to update your database or preview them without querying.
You can remove all of your entities before upgrading.
Every time you run this command, `doctrine:generate-entities` is called

```
php artisan doctrine:update [-D | --dump-sql] [-R | --remove-entities]
php artisan doctrine:update -DR
```

Options:

```
  -D, --dump-sql         Dumps generated SQL statements to the console (does not execute them)
  -R, --remove-entities  Delete current entities before generating new ones

```

#### · Cache clear

[](#-cache-clear)

Sometimes you can get missing entity errors, deleting cached data can help to fix it.

```
php artisan doctrine:clear-cache [--flush]

# This command will run these three commands at once, you can run them separately if you want
php artisan doctrine:clear-cache:metadata [--flush]
php artisan doctrine:clear-cache:query [--flush]
php artisan doctrine:clear-cache:result [--flush]
```

Options:

```
  --flush    If defined, cache entries will be flushed instead of deleted/invalidated

```

#### · Generate migrations (for testing)

[](#-generate-migrations-for-testing)

For testing purposes, you will need your project migrations. You can generate it with the following command.
By default, they will be generated in `tests/database/migrations`

```
php artisan doctrine:migrations-generate [destination/path]
php artisan doctrine:migrations-generate --tables users,password_resets --ignore users,password_resets
```

Arguments:

```
  path    If defined, it will generate the files in the given path, by default

```

Options:

```
  -R, --remove                     Remove previous generated migration files
  -O, --output                     View migrations package console output
  -S, --single-file[=SINGLE-FILE]  Generate all migrations in a single file [default: "true"]
  -T, --tables[=TABLES]            A list of Tables or Views you wish to Generate Migrations separated by comma: users,products,labels
  -I, --ignore[=IGNORE]            A list of Tables or Views you wish to ignore, separated by comma: users,products,labels

```

### Available commands for the "doctrine" namespace

[](#available-commands-for-the-doctrine-namespace)

```
  doctrine:clear-cache           Clear metadata, query and result cache of the various cache drivers
  doctrine:clear-cache:metadata  Clear all metadata cache of the various cache drivers
  doctrine:clear-cache:query     Clear all query cache of the various cache drivers
  doctrine:clear-cache:result    Clear all result cache of the various cache drivers
  doctrine:convert-mapping       Convert mapping information between supported formats
  doctrine:generate-entities     Generate entity classes and method stubs from your mapping information (xml-mappings)
  doctrine:generate-mappings     Generate xml-mappings from your database
  doctrine:remove-entities       Remove all entities
  doctrine:update                Update the database (or dump SQL) based on the entities information
  doctrine:validate              Validate mappings and synchronization with the database
  doctrine:migrations-generate   Generate laravel migration files from database
```

You can see the arguments and options of each of them with the help command

```
php artisan -help

```

### utf8mb4

[](#utf8mb4)

To change the character set and collation of a table, add this `options` to the `entity`

```

    utf8mb4_unicode_ci
    utf8mb4

```

#### Problems with mysql 5.7

[](#problems-with-mysql-57)

mysql versions prior to 5.7.7 may throw an error "*Specified key was too long; max key length is 767 bytes*"
You must verify that any column of type `string` and `unique=true` must set its maximum `length="190"`

**Important, check the indexes**

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Sergio](https://github.com/sergio-item)
- [Itemvirtual](https://github.com/itemvirtual)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Doctrine XML Mapping documentation and examples
-----------------------------------------------

[](#doctrine-xml-mapping-documentation-and-examples)

[Doctrine documentation](https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/reference/xml-mapping.html)[Doctrine Types](https://www.doctrine-project.org/projects/doctrine-dbal/en/2.8/reference/types.html)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

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

Recently: every ~156 days

Total

7

Last Release

1155d ago

PHP version history (3 changes)1.0.0PHP ^7.1

1.0.4PHP ^7.1|^8.0

1.0.5PHP ^7.1 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![sergio-item](https://avatars.githubusercontent.com/u/10372524?v=4)](https://github.com/sergio-item "sergio-item (13 commits)")

---

Tags

itemvirtuallaravel-doctrine

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/itemvirtual-laravel-doctrine/health.svg)

```
[![Health](https://phpackages.com/badges/itemvirtual-laravel-doctrine/health.svg)](https://phpackages.com/packages/itemvirtual-laravel-doctrine)
```

###  Alternatives

[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[neos/flow-development-collection

Flow packages in a joined repository for pull requests.

144179.3k3](/packages/neos-flow-development-collection)[concrete5/core

Concrete core subtree split

19159.3k48](/packages/concrete5-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)[mahocommerce/maho

Free and open source ecommerce platform, created in 2024 on the M1 platform, PHP 8.3+

1322.1k12](/packages/mahocommerce-maho)

PHPackages © 2026

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