paulobunga/parkman-schema
Composer 安装命令:
composer require paulobunga/parkman-schema
包简介
Generate Laravel model and migrations from Prisma Schema
README 文档
README
Parkman Schema is a powerful Laravel package that generates Laravel migrations and models from Prisma schema files. It simplifies the process of transitioning from Prisma to Laravel by automatically creating the necessary database structure and Eloquent models.
Installation
You can install the package via composer:
composer require paulobunga/parkman-schema
Usage
Generate Migrations
To generate Laravel migrations from your Prisma schema:
use Paulobunga\ParkmanSchema\Parkman; $parkman = new Parkman(); $parkman->setSchema(file_get_contents('path/to/your/schema.prisma')); $parkman->generateMigrations();
This will create migration files in your Laravel project's database/migrations directory.
Generate Models
To generate Eloquent models from your Prisma schema:
use Paulobunga\ParkmanSchema\Parkman; $parkman = new Parkman(); $parkman->setSchema(file_get_contents('path/to/your/schema.prisma')); $parkman->generateModels();
This will create model files in your Laravel project's app/Models directory.
Using Artisan Commands
The package also provides Artisan commands for easy use:
# Generate everything php artisan parkman:generate path/to/your/schema.prisma --all # Generate specific components (migrations are generated by default if no flags) php artisan parkman:generate path/to/your/schema.prisma --models --controllers # Individual commands (legacy) php artisan parkman:generate-migrations path/to/your/schema.prisma php artisan parkman:generate-models path/to/your/schema.prisma
Customizing Stubs
You can publish the stub files to customize the generated migrations and models:
php artisan vendor:publish --provider="Paulobunga\ParkmanSchema\ParkmanSchemaServiceProvider" --tag="stubs"
This will copy the stub files to resources/stubs/vendor/parkman-schema in your Laravel project, where you can modify them to fit your needs.
Features
- Generates Laravel migrations from Prisma schema
- Creates Eloquent models with relationships
- Supports table creation, modification, and deletion
- Handles column additions, removals, and renames
- Manages foreign key constraints
- Automatically reorders migrations based on dependencies
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email paulobunga.one@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
paulobunga/parkman-schema 适用场景与选型建议
paulobunga/parkman-schema 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 08 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「paulobunga」 「parkman-schema」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 paulobunga/parkman-schema 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 paulobunga/parkman-schema 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 paulobunga/parkman-schema 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-03