sigmaphp/sigmaphp-db
Composer 安装命令:
composer require sigmaphp/sigmaphp-db
包简介
PHP Database Tools
关键字:
README 文档
README
SigmaPHP-DB is a collection of PHP Database Tools. That support primarily MySQL RDBMS (Other RDBMS support will be added in future). Including migrations with rollback , seeding , query builder , ORM and much more , all these features can be used through an elegant CLI script in your terminal.
Installation
composer require sigmaphp/sigmaphp-db
Configurations
After installation , you should create a new config file , to include your database connection parameters , and also edit other options like migrations / seeders paths.
To generate new config file , run the following command :
php ./vendor/bin/sigma-db create:config
A new config file with name database.php wil be created in the root of your project's directory.
You can simply change the name and the location of the config file , but this will require you , to pass the config file path , when use the CLI script :
php ./vendor/bin/sigma-db migrate --config=/path/to/my-config.php
Documentation
CLI Usage
In the table below , you can find all available commands :
| Command | Description |
| create:config {path} | Create new config file, if no path was provided , a default config file (database.php) will be created in the root of the project's folder. |
| create:migration {migration name} | Create new migration file. It's recommended for the migration file to follow class naming rules , like using only nouns and PascalCase .. etc. Also no need to add .php extension , "Migration.php". will be appended automatically to the file name. |
| create:model {model name} | Create new model class. In addition this command will generate a migration file for creating the corresponding table. |
| create:seeder {seeder name} | Create new seeder file. Please note that , the same rules for naming the migration file is also applied to the seeder. |
| drop | Drop all tables in the database. A confirmation message will ask you to confirm before executing this command. |
| fresh | Drop all tables in the database. then will run all migrations and seed the database. (will ask for confirmation) |
| help | Print a list by all available commands. |
| migrate {migration name} | Run all migrations files. Optionally you can pass migration file name , to run specific migration. |
| rollback {date} | Rollback latest migration. or choose specific date to rollback to. |
| seed {seeder name} | Run seeders. or run specific seeder. |
| version | Print the current version of SigmaPHP-DB Package. |
| truncate | Delete the data in all tables. (will ask for confirmation) |
And here few examples on how to use the commands:
php ./vendor/bin/sigma-db create:migration UsersTable
// will create UsersTableMigration.php file into /path/to/migrations
php ./vendor/bin/sigma-db create:seed UsersRolesSeeder
// run seeder UsersRolesSeeder.php
php ./vendor/bin/sigma-db rollback 2023-1-20
// rollback all migrations up to 2023-1-20 , the migrations running dates all saved into the migrations logs table (default name is db_logs). And of course you can change it in the config file
php ./vendor/bin/sigma-db drop
// to drop all tables
php ./vendor/bin/sigma-db fresh --config=/path/to/db-testing-config.php
// to drop all tables then migrate and seed , and in this example we assume that you have put the config in your path of choice
License
(SigmaPHP-DB) released under the terms of the MIT license.
sigmaphp/sigmaphp-db 适用场景与选型建议
sigmaphp/sigmaphp-db 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 123 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「SigmaPHP」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sigmaphp/sigmaphp-db 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sigmaphp/sigmaphp-db 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sigmaphp/sigmaphp-db 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
PHP Router
PHP Database Tools
A powerful template engine for PHP
PHP Dependency Injection Container
SigmaPHP Framework Core Components
统计信息
- 总下载量: 123
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-05