dantleech/phpcr-migrations-bundle
最新稳定版本:1.3.0
Composer 安装命令:
composer require dantleech/phpcr-migrations-bundle
包简介
PHPCR migrations bundle
README 文档
README
This library provides a Symfony integration for the PHPCR migrations library.
This version has been archived
This bundle has been renamed to phpcr/phpcr-migrations-bundle. We recommend to update your dependencies to get the latest version.
dantleech/phpcr-migrations-bundle will remain available to not break existing installations, but
is no longer maintained.
Configuration
Configure the path to your migrations:
# app/config.yml phpcr_migrations: paths: [%kernel.root_dir%/phpcr-migrations]
Or the bundle will automatically pick up any migrations in the
Resources/phpcr-migrations folder in any bundles registered in the kernel.
Creating migrations
First create two new migration files:
<?php // app/phpcr-migrations/Version201501011200.php use PHPCR\SessionInterface; use PHPCR\Migrations\VersionInterface; class Version201501011200 implements VersionInterface { public function up(SessionInterface $session) { $session->getRootNode()->addNode('hello'); } public function down(SessionInterface $session) { $session->getRootNode()->getNode('hello')->remove(); } }
and
<?php // app/phpcr-migrations/Version201501011212.php use PHPCR\SessionInterface; use PHPCR\Migrations\VersionInterface; class Version201501011212 implements VersionInterface { public function up(SessionInterface $session) { $session->getNode('/hello')->addNode('world'); } public function down(SessionInterface $session) { $session->getNode('/hello')->getNode('world')->remove(); } }
Migration status
Note that migration MUST be named as follows: VersionYYYMMDDHHSS. If they
are not so-named, they will not be detected. The timestamp SHOULD be the
current date (in this example 2015/01/01 12:00).
Now execute the phpcr:migrations:status command:
$ php app/console phpcr:migrations:status +--+---------------+------------------+----------+----------------------------------------------+ | | Version | Date | Migrated | Path | +--+---------------+------------------+----------+----------------------------------------------+ | | 201501011200 | 2015-01-01 12:00 | NO | app/phpcr-migrations/Version201501011200.php | | | 201501011212 | 2015-01-01 12:12 | NO | app/phpcr-migrations/Version201501011212.php | +--+---------------+------------------+----------+----------------------------------------------+ No migrations have been executed
Executing migrations
Now we can run the migrations:
$ php app/console phpcr:migrations:migrate Upgrading 2 version(s): + [1/2]: 201501011200 + [2/2]: 201501011212
This should run the two migrations, your status should not look like this:
Reverting
You can now revert back to the first version as follows:
$ php app/console phpcr:migrations:migrate 201501011200 Reverting 1 version(s): - [1/4]: V201501011212
Actions
In addition to specifying versions you can specify actions:
$ php app/console phpcr:migrations:migrate up Upgrading 1 version(s): - [1/4]: V201501011212
Actions are:
up: Upgrade one versiondown: Revert one versiontop: Migrate to the latest versionbottom: Revert all migrations
dantleech/phpcr-migrations-bundle 适用场景与选型建议
dantleech/phpcr-migrations-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.13M 次下载、GitHub Stars 达 50, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 dantleech/phpcr-migrations-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dantleech/phpcr-migrations-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.13M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 50
- 点击次数: 22
- 依赖项目数: 25
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04