n2boost/laravel-doctrine-mapping
Composer 安装命令:
composer require n2boost/laravel-doctrine-mapping
包简介
README 文档
README
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
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 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
Config Yml-Orm
Generate Entities
php artisan n2boost:orm:generate-entities
Sync Database
php artisan n2boost:orm:scheme-tool:update
Sponsor
文档参考:
Laravel 5.5 Package Development – Markus Tripp – Medium How to create a Laravel 5 package in 10 easy steps - Laravel Daily
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
n2boost/laravel-doctrine-mapping 适用场景与选型建议
n2boost/laravel-doctrine-mapping 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.29k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 07 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 n2boost/laravel-doctrine-mapping 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 n2boost/laravel-doctrine-mapping 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.29k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-10