juggernaut-lab/microservice-helper
Composer 安装命令:
composer require juggernaut-lab/microservice-helper
包简介
A Laravel package for microservice teams to share migrations, enums, utilities, and scaffolding across multiple Laravel projects.
README 文档
README
A Laravel toolkit engineered to help microservice teams centralize and synchronize shared database migrations, enums, helpers, scaffolding generators, and core logic across multiple Laravel applications.
This package brings structure, consistency, and developer efficiency to multi-repo or multi-service Laravel environments.
What It Solves
- Prevents schema drift across microservices
- Centralizes shared logic and reusable components
- Provides internal scaffolding for rapid package updates
- Enables safe and intelligent migration publishing
- Ensures predictable changes across distributed apps
- Eliminates duplication of enums, helpers, and domain classes
- Provides a workflow and tooling model for collaborative teams
Designed for engineering teams where multiple Laravel services depend on shared domain logic or a shared database.
Table of Contents
- Overview
- Features
- Installation
- Local Development (Symlink Mode)
- Migration Management
- Scaffolding System
- Commands
- Recommended Workflow
- Handling Shared Environments (Staging/Prod)
- Project Structure
- Future Enhancements
Overview
The Juggernaut Lab — Laravel Microservice Helper package acts as a foundational layer for multi-service Laravel ecosystems.
It centralizes:
- Database migrations
- Enums
- Shared business logic
- Scaffolding & code generation
- Utilities and helper classes
- Schema definitions
- Internal developer tooling
This ensures every service remains aligned, even when multiple teams contribute to shared domain concepts.
Features
✔ Centralized Shared Migrations
One source of truth for database schema shared across multiple Laravel apps.
✔ Smart Migration Publisher
Publishes only new migrations to prevent duplication or corruption.
✔ Internal Scaffolding System
Generate shared components directly inside the package:
- Migrations
- Classes
- Enums
- Full “bundle” creation (migration + class + enum)
✔ Symlink-Aware Package Development
When installed via path repository, the package becomes editable in real time.
✔ Microservice-Ready Architecture
Ideal for teams operating multiple Laravel services backed by a shared or partially shared database.
Installation
Install via Composer:
composer require juggernaut-lab/microservice-helper
Publish package migrations:
php artisan juggernaut:publish-migrations
Local Development (Symlink Mode)
For package maintainers, Juggernaut Lab supports a local symlink workflow that enables real-time editing and testing.
Benefits
- Live editing of package files
- No modifying vendor/ files
- Perfect for contributors improving the package
- Ideal for multi-developer collaboration
Strict Rule
Do NOT commit path repositories or symlink configs.
Use a local-only override file.
Step 1 — Create composer.local.json
composer.local.json
{
"repositories": [
{
"type": "path",
"url": "../microservice-helper",
"options": { "symlink": true }
}
]
}
Step 2 — Gitignore It
composer.local.json
Step 3 — Install in Symlink Mode
composer update juggernaut-lab/microservice-helper
Result
- Maintainers work live within the package
- Nothing leaks into Git
- Staging/production do not use symlinks
- Team members stick to normal Composer installs
Migration Management
Shared migrations live inside the package:
microservice-helper/database/migrations/
Publish them into the host application:
php artisan juggernaut:publish-migrations
How the Publisher Works
- Detects existing migrations
- Publishes only new files
- Protects against duplication
- Supports
--forcefor overwrites - Summarizes changes
Example output:
Total migrations in package: 1025
Existing in project already: 1023
Newly published migrations: 2
New migrations added:
✔ 2025_01_10_000000_add_wallets_table.php
✔ 2025_01_11_000000_create_invoice_table.php
Scaffolding System
Juggernaut Lab includes an internal scaffolding engine for generating new shared components.
All generated files are written inside the package itself, not inside the consuming Laravel project.
Available Generators
- Migration Generator
- Class Generator
- Enum Generator
- Full Bundle Generator (migration + class + enum)
This ensures every shared artifact remains consistent and centralized.
Commands
1. Publish Migrations
php artisan juggernaut:publish-migrations
Force overwrite:
php artisan juggernaut:publish-migrations --force
2. Generate a Migration
php artisan juggernaut:make-migration create_orders_table --create=orders
Modify a table:
php artisan juggernaut:make-migration add_status_to_users --table=users
Generated into:
microservice-helper/database/migrations/
3. Generate a Class
php artisan juggernaut:make-class MoneyFormatter
With namespace:
php artisan juggernaut:make-class TaxService --namespace=Services
4. Generate an Enum
php artisan juggernaut:make-enum UserStatus
5. Generate Everything (Migration + Class + Enum)
php artisan juggernaut:make-all Order --create=orders
Recommended Workflow
This workflow ensures clean, safe collaboration between:
- Package maintainers
- Microservice developers
- Staging & production environments
1. Package Maintainers
Use symlink mode:
- Enable via
composer.local.json - Modify shared code/migrations/enums
- Generate components using
juggernaut:make-* - Publish updated migrations into local microservices
- Push package updates to GitHub
- Tag a release:
git tag v1.1.0 git push origin v1.1.0
2. Microservice Developers
No symlink. No scaffolding.
Workflow:
git pull composer install php artisan migrate
3. Staging & Production
Never use symlink mode.
Workflow:
composer install --no-dev php artisan migrate
Shared DB Rule
If multiple services share one DB:
DB_LEADER_SERVICE=true
Others:
DB_LEADER_SERVICE=false
Workflow Summary Table
| Role | Uses Symlink? | Generates Code? | Publishes Migrations? | Runs Migrations? |
|---|---|---|---|---|
| Maintainer | YES | YES | YES | YES |
| Team Member | NO | NO | NO | YES |
| Staging | NO | NO | NO | YES (leader only) |
| Production | NO | NO | NO | YES (leader only) |
Project Structure
microservice-helper/
├── src/
│ ├── Commands/
│ │ ├── PublishMigrationsCommand.php
│ │ ├── MakeMigrationCommand.php
│ │ ├── MakeClassCommand.php
│ │ ├── MakeEnumCommand.php
│ │ └── MakeAllCommand.php
│ ├── MicroserviceHelperServiceProvider.php
│ └── ...
├── database/
│ └── migrations/
├── stubs/
│ ├── class.stub
│ └── enum.stub
└── composer.json
Future Enhancements
- Dry-run mode for migration publishing
- Hash-based migration integrity checks
- JSON output mode for CI pipelines
- Additional scaffold types (DTOs, services, events, models)
- Domain module generators
- Diagnostics tooling (
juggernaut:doctor) - Automatic Pint formatting on generation
Conclusion
The Juggernaut Lab – Laravel Microservice Helper provides a clean, scalable, team-friendly foundation for multi-service Laravel architectures.
It streamlines collaboration, prevents schema drift, centralizes business logic, and gives engineering teams a predictable workflow for managing shared domain components.
juggernaut-lab/microservice-helper 适用场景与选型建议
juggernaut-lab/microservice-helper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「scaffolding」 「Microservice」 「developer-tools」 「juggernaut-lab」 「shared-migrations」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 juggernaut-lab/microservice-helper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 juggernaut-lab/microservice-helper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 juggernaut-lab/microservice-helper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Библиотека для реализаций паттерна Pub/Sub
Библиотека для реализаций паттерна Pub/Sub
Implementation of the transactional outbox pattern on top of rekalogika/domain-event
Php framework that provide easy way to create php micro-services
A set of core functionality and convenience classes for a Lumen microservice.
A set of model related utility and convenience classes for a Lumen microservice.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-27