roberts/support
Composer 安装命令:
composer require roberts/support
包简介
Common functions used in Laravel packages
README 文档
README
Traits, Helper functions, and scaffolding tools for Laravel packages & applications.
🚀 Quick Start: Project Scaffolding
Quickly set up GitHub Workflow, Actions and Docker:
composer require roberts/support composer support:scaffold
This automatically generates:
- ✅ GitHub Actions workflows (tests, PHPStan, linting)
- ✅ Docker configuration for Cloud Run
- ✅ PHPStan configuration
- ✅ VS Code workspace settings
Features
Project Scaffolding
- Auto-detect project type (Laravel app or package)
- Smart detection of features (Flux, Filament, Twitter, Mail)
- One command to set up complete CI/CD pipeline
- Google Cloud Run deployment ready
Model Traits
- HasCreator
- HasUpdater
Model Traits for Status
- HasActiveStatus
- HasApplicationStatus
- HasApprovalStatus
- HasModeratorStatus
- HasOrderStatus
- HasProcessingStatus
- HasPublishingStatus
- HasSubscriptionStatus
Installation
You can install the package via composer:
composer require roberts/support
Usage
On packages or Laravel applications that require this package, you can add the Traits to models like:
use HasCreator, HasUpdater, HasPublishingStatus;
You may only add 1 of the Status Traits since they all use the same status database column. They are not designed to work together but to replace the functionality with the Enum structures.
Expected Columns
When using any of the Status Traits on a model, add the following format for the status database column on your table:
status(string (25 character max), nullable, index)
Note: Status traits automatically set appropriate default values when models are created (e.g., pending for moderator status, active for active status).
When using the HasCreator and/or HasUpdater traits on a model, add the following nullable columns to your table:
creator_id(unsignedBigInteger, nullable)updater_id(unsignedBigInteger, nullable)
Example migration snippet:
Schema::table('your_table', function (Blueprint $table) { $table->string('status', 25)->nullable()->index(); $table->foreignId('creator_id')->nullable()->constrained('users'); $table->foreignId('updater_id')->nullable()->constrained('users'); });
The traits automatically:
- Set
creator_idon model creating (when an authenticated user is present). - Set
updater_idon model saving (create and update) when an authenticated user is present.
Overriding the Auth Provider Model
By default, the creator & updater traits resolve the related user model from config('auth.providers.users.model').
If your application uses a different provider or model, ensure the config points to your user class. For example, in config/auth.php:
'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\Models\User::class, ], ],
Or override at runtime (e.g., inside a service provider) if needed:
config(['auth.providers.users.model' => App\Domain\Auth\User::class]);
Enums
Status traits use enums with the following values, setting the first one on model creation:
HasActiveStatus: active, inactiveHasApplicationStatus: pending, started, verified, applied, accepted, rejectedHasApprovalStatus: pending, submitted, approved, rejectedHasModeratorStatus: pending, flagged, approved, rejectedHasOrderStatus: cart, pending, checkout, paid, shipped, delivered, canceledHasProcessingStatus: pending, processing, completed, failedHasPublishingStatus: draft, scheduled, published, archivedHasSubscriptionStatus: trial, active, canceled, expired
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
roberts/support 适用场景与选型建议
roberts/support 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.18k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「support」 「laravel」 「laravel package」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 roberts/support 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 roberts/support 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 roberts/support 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 2.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-11