kurl/silex-doctrine-migrations-provider
Composer 安装命令:
composer require kurl/silex-doctrine-migrations-provider
包简介
A doctrine migrations provider for silex
README 文档
README
A doctrine migrations service provider for Silex 2.x or Pimple 3.x.
Installation
Install the provider through Composer:
composer require kurl/silex-doctrine-migrations-provider
Usage
Parameters
These are the configuration parameters you could configure for the provider:
migrations.directory: The directory with migrations. Required.migrations.namespace: The namespace for the migration classes. Required.migrations.name: The name of the migrations suite. Defaults to "Migrations".migrations.table_name: The database migrations table. Defaults tomigration_versions.
Services
The service provider registers the following services which you could use:
migrations.em_helper_set: The Doctrine ORM Entity Manager helper set. It would be registered if you have registered theorm.emservice supposedly from the `DoctrineServiceProvider.migrations.commands: An array of Symfony command instances. You could use them to add to your own Console application.
There are also a few other services which the provider uses internally and they are exposed so you could extend or override them with the lazy loading of Pimple:
migrations.output_writer:Doctrine\DBAL\Migrations\OutputWriterinstance used in the Doctrine migrations configuration.migrations.configuration:Doctrine\DBAL\Migrations\Configuration\Configurationinstance used in the console commands.migrations.command_names: Array of command names. You could add your own here to be lazy loaded intomigrations.commands.
You can register the provider and configure it like so:
<?php $app->register( new \Kurl\Silex\Provider\DoctrineMigrationsProvider(), array( 'migrations.directory' => __DIR__ . '/../path/to/migrations', 'migrations.name' => 'Acme Migrations', 'migrations.namespace' => 'Acme\Migrations', 'migrations.table_name' => 'acme_migrations', ) );
Silex
You can pass an optional instance of Symfony\Component\Console\Application to the constructor of the provider. Alternatively you can set the instance of your Console application to $app['console']. If the provider can find the Console application instance it is able to register the commands and helper set for you.
The provider implements `Silex\Api\BootableProviderInterface, so if you use the provider with Silex, booting the application would register the commands for you:
<?php $console = new \Symfony\Component\Console\Application(); $app->register( new \Kurl\Silex\Provider\DoctrineMigrationsProvider($console), array( 'migrations.directory' => __DIR__ . '/../path/to/migrations', 'migrations.namespace' => 'Acme\Migrations', ) ); $app->boot(); $console->run();
Pimple
If you use the provider with Pimple without using Silex, then you'd need to register the helper set and the commands to your Console application yourself. This is made very easy by the provider as it already registered all the needed services:
<?php $console = new \Symfony\Component\Console\Application(); $app->register( new \Kurl\Silex\Provider\DoctrineMigrationsProvider(), array( 'migrations.directory' => __DIR__ . '/../path/to/migrations', 'migrations.namespace' => 'Acme\Migrations', ) ); // Register helper set and commands from the `DoctrineMigrationsProvider` $console->setHelperSet($app['migrations.em_helper_set']); $console->addCommands($app['migrations.commands']); $console->run();
Code coverage reports
$ bin/phpunit --coverage-html build/coverage --coverage-clover build/logs/clover.xml --log-junit build/logs/phpunit.xml
That was it!
kurl/silex-doctrine-migrations-provider 适用场景与选型建议
kurl/silex-doctrine-migrations-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 155.04k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2014 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kurl/silex-doctrine-migrations-provider 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kurl/silex-doctrine-migrations-provider 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 155.04k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 22
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-15