PHPackages                             n2boost/laravel-doctrine-mapping - 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. n2boost/laravel-doctrine-mapping

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

n2boost/laravel-doctrine-mapping
================================

2.0.1(7y ago)21.3kMITPHP

Since Jul 10Pushed 7y ago2 watchersCompare

[ Source](https://github.com/n2boost/laravel-doctrine-mapping)[ Packagist](https://packagist.org/packages/n2boost/laravel-doctrine-mapping)[ RSS](/packages/n2boost-laravel-doctrine-mapping/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

Generate Entities and Sync Database with Yml Config File
========================================================

[](#generate-entities-and-sync-database-with-yml-config-file)

- [Installation](#installation)
- [Usage](#usage)
    - [Config Yml-Orm](#config-yml-orm)
    - [Generate Entities](#generate-entities)
    - [Sync Database](#sync-database)
- [Example](#example)
- [Contributing](#contributing)
- [License](#license)

This package allows you to manage database scheme with yml orm config.

The orm config file just like this:

```
Entity\User:
    type: entity
    table: user
    id:
        id:
            type: integer
            id: true
            generator:
                strategy: IDENTITY
    fields:
        username:
            type: string
            nullable: true
            length: 128
        password:
            type: string
            nullable: true
```

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

[](#installation)

### Laravel

[](#laravel)

This package can be used in Laravel 5.4 or higher.

You can install the package via composer:

```
composer require n2boost/laravel-doctrine-mapping dev-master
```

In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in `config/app.php` file:

```
'providers' => [
    // ...
    N2boost\LaravelDoctrineMapping\LaravelDoctrineMappingServiceProvider::class,
];
```

You can publish the config file with:

```
php artisan vendor:publish --provider="N2boost\LaravelDoctrineMapping\LaravelDoctrineMappingServiceProvider::class" --tag="config"
```

If it doesn't works, please type:

```
php artisan vendor:publish
```

And select the true number options.

When published, [the `config/laravel-doctrine-mapping.php` config file](https://github.com/spatie/laravel-permission/blob/master/config/permission.php) contains:

```
return [

    /*
     * Mapping Config Engines.
     * Can set to: yaml
     */

    'mapping_type' => 'yaml',

    /*
     * Mapping config files dir
     * full path will like this example: config/mappings/yaml/User.dcm.yml
     */
    'mapping_file_dir' => 'config/mappings',

    'entities_file_dir' => 'resources/classes',

    'profile' => 'local',
    'isDevMode' => true,

    'use_connection_pool' => 'laravel', // laravel, self
    'connection' => 'mysql',

    'connections' => [
        'mysql' => [
            'driver' => 'pdo_mysql',
            'host' => '127.0.0.1',
            'port' => 3306,
            'user' => 'root',
            'password' => '',
            'dbname' => 'hunter',
            'charset' => 'utf8mb4',
            'collate' => 'utf8mb4_unicode_ci',
        ]
    ]
];
```

If you use `yaml` config file engine, please install this dependence:

```
composer require symfony/yaml

```

Usage
-----

[](#usage)

- [Config Yml-Orm](#config-yml-orm)
- [Generate Entities](#generate-entities)
- [Sync Database](#sync-database)

### Config Yml-Orm

[](#config-yml-orm)

### Generate Entities

[](#generate-entities)

```
php artisan n2boost:orm:generate-entities

```

### Sync Database

[](#sync-database)

```
php artisan n2boost:orm:scheme-tool:update

```

### Sponsor

[](#sponsor)

文档参考:

[Laravel 5.5 Package Development – Markus Tripp – Medium](https://medium.com/@markustripp/laravel-5-5-package-development-e72f3e7a8f38)[How to create a Laravel 5 package in 10 easy steps - Laravel Daily](https://laraveldaily.com/how-to-create-a-laravel-5-package-in-10-easy-steps/)

Design
------

[](#design)

Config file

config/laravel-doctrine-mapping.php

- 配置数据库连接
- 配置 mapping 文件目录
- 配置 entity 生成文件目录

Command Lines

- php artisan n2boost:orm:generate-entities
- php artisan n2boost:orm:scheme-tool:update

Tools

composer remove symfony/yaml composer require symfony/yaml

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Total

6

Last Release

2864d ago

Major Versions

0.01 → 1.0.0-beta2018-07-10

1.0.2 → 2.0.02018-08-28

### Community

Maintainers

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

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M379](/packages/easycorp-easyadmin-bundle)[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.

1175.2k](/packages/rcsofttech-audit-trail-bundle)[kimai/kimai

Kimai - Time Tracking

4.8k8.7k1](/packages/kimai-kimai)[api-platform/doctrine-orm

Doctrine ORM bridge

294.4M83](/packages/api-platform-doctrine-orm)

PHPackages © 2026

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