Download the PHP package crazyfd/php-migrations without Composer

On this page you can find all versions of the php package crazyfd/php-migrations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-migrations

php-migrations (crazyfd/php-migrations)

为 PHP 应用提供尽可能接近 Laravel 的数据库迁移能力,底层直接复用 Illuminate Database(支持 10.x / 11.x / 12.x / 13.x) 原生 Migrator / Schema Builder,行为与 Laravel Migration 保持一致。本包内置 Webman 集成,可直接通过 php webman migrate 使用。

基于 hyde1/eloquent-migrations / pxianyu/webman-migrations 升级维护,感谢原作者。

背景

我们的业务迭代很快,之前技术栈是 Laravel + Octane。但由于业务场景比较特殊、流量较大,服务经常遇到性能瓶颈和稳定性问题,在现有硬件资源无法进一步扩容的情况下,我们经过多方面评估,最终将 Laravel 迁移到了 Webman。

迁移之后,Webman 在高并发和高性能场景下的表现确实非常优秀,也很好地解决了我们之前遇到的一些问题。

但在实际迁移过程中,我们也发现了一个比较明显的问题:Laravel 生态经过多年的发展,已经形成了一套非常完善、成熟的组件体系,而 Webman 生态中的部分通用组件存在维护不及时、版本兼容性不足,以及与新版 illuminate/* 组件适配不完善等情况。

与此同时,我们并不希望因为从 Laravel 迁移到 Webman,就放弃 Laravel 中成熟的开发习惯和生态能力。更重要的是,我们希望 Laravel → Webman 的迁移能够尽可能平滑,让原有项目的代码、业务逻辑和成熟组件得到最大程度的复用,而不是为了适配 Webman 而进行大量重构和重复开发。

因此,我们决定围绕现代 Laravel / Illuminate 生态进行适配和维护,在保持 Laravel 原有使用方式和开发体验的基础上,让这些组件能够更好地运行在 Webman 环境中。通过这种方式,尽可能降低 Laravel 项目迁移到 Webman 的改造成本,让原有代码少改甚至不改即可继续使用。

不仅仅是解决当前项目的兼容性问题,更是逐步补齐 Webman 生态中缺失的通用组件,并长期维护一批高质量、现代化的 PHP 组件包,同时将 Webman 作为官方支持的一等集成场景。

简单来说,我们希望做到:

享受 Webman 的高性能,同时保留 Laravel 成熟的生态、开发体验和代码资产,让 Laravel → Webman 不再意味着大规模重写。

环境要求

注意:实际 PHP 最低版本还取决于安装的 illuminate major 版本;例如 illuminate/database 13.x 要求 PHP >= 8.3。

Webman 集成为可选依赖(suggest),需要时安装:

安装

安装后自动创建:

框架集成

目前阶段适配 Webman,其他框架暂无;后续会根据实际需求再评估适配(核心层已框架无关,集成成本可控)。

Webman

配置数据库

在 Webman 中,本项目直接读取 config/database.php:

默认连接会同时注册为 default,因此 -d default 与 -d mysql(默认连接名)等价。

编写 Migration(Laravel 风格)

Schema Facade 已由本插件自动注册,迁移文件内可以像 Laravel 一样直接使用 Schema::、Blueprint 等。

也可以使用迁移基类提供的连接(不依赖 Facade):

命令

命令 说明
php webman migrate 执行迁移(等价 Laravel migrate)
php webman migrate:install 创建 migrations 记录表(migrate 会自动执行)
php webman migrate:rollback 回滚上一批迁移
php webman migrate:reset 回滚全部迁移
php webman migrate:refresh 回滚全部并重新执行
php webman migrate:fresh 删除所有表并重新执行
php webman migrate:status 查看迁移状态
php webman migrate:create 生成迁移文件
php webman seed:run 执行数据填充(Laravel 风格命令 db:seed)
php webman db:seed 执行数据填充(等价 Laravel db:seed,支持 --class=XxxSeeder)
php webman seed:create 生成填充文件
php webman make:seeder 生成填充文件(等价 Laravel make:seeder)
php webman create:database 创建数据库

常用参数:

示例:

Seeder

Laravel Compatibility

与 Laravel 基本一致:

与 Laravel 的差异(由 Webman 架构决定):

架构分层

本包核心层框架无关,Webman 只是官方支持的一等集成场景:

独立使用(无框架)

在项目根目录创建 elmigrator.php:

然后:

加载配置文件时会自动注册 Schema 等 Facade,迁移文件内可继续使用 Laravel 写法。

其他框架(自行集成,暂无官方支持)

目前官方只提供 Webman 集成。其他框架可以自行通过 ConfigResolver::set() 注入配置数组后,使用 Eloquent\Migrations\Application::create() 获取注册好全部命令的 Symfony Console 应用;如有通用框架(如 Symfony、ThinkPHP)的官方适配需求,欢迎提 issue 反馈。

兼容矩阵

Package Version PHP Framework Integration illuminate/database Status
2.x >=8.1; 13.x requires >=8.3 Webman ^1.5 / ^2.0 10.x - 13.x Maintained

Database Support

数据库 状态
SQLite 已测试通过
MySQL 已测试通过(MySQL 9.x / illuminate 13)
PostgreSQL 已测试通过(PostgreSQL 18 / illuminate 13)

常见问题

migrate:status 提示 "The migration table is not installed"

这不是报错,是首次使用前的正常状态:migrations 记录表尚未创建。执行一次 php webman migrate(或 php webman migrate:install)即可自动创建。

SQLite 报 "Database file at path ... does not exist"

illuminate/database 10+ 出于安全考虑不会自动创建 SQLite 文件(防止在错误路径静默建库)。两种解决方式:

运行测试

License

MIT


All versions of php-migrations with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
illuminate/database Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/console Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/filesystem Version ^10.0 || ^11.0 || ^12.0 || ^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package crazyfd/php-migrations contains the following files

Loading the files please wait ...