ninjaportal/portal
Composer 安装命令:
composer require ninjaportal/portal
包简介
A Laravel Like Apigee DevPortal
README 文档
README
Core domain package for NinjaPortal.
It provides:
- Portal data models (users, categories, API products, audiences, menus, settings)
- Repository + service abstractions
- Translatable model support
- Apigee-backed developer app + credential services
- Core events/policies/RBAC seeding
ninjaportal/portal intentionally keeps API authentication concerns out of the core
package. JWT-aware user/admin models are provided by ninjaportal/portal-api.
Install
From the Laravel app (backend):
php artisan portal:install
Safer install options:
php artisan portal:install --force-provider-overwrite php artisan portal:install --delete-default-users-migration
Notes:
- The installer does not overwrite
App\Providers\NinjaPortalServiceProviderunless you pass--force-provider-overwrite. - The installer does not delete Laravel's default users migration unless you pass
--delete-default-users-migration.
Seeding
php artisan portal:seed --all php artisan portal:seed --settings --rbac php artisan portal:seed --demo
RBAC And Policies
The package now standardizes model-policy permissions using:
portal.{model}.{ability}
Examples:
portal.user.view_anyportal.user.updateportal.api_product.createportal.setting_group.delete
Route/API level permissions remain:
portal.admin.accessportal.rbac.manageportal.admins.manageportal.activities.view
The RbacSeeder seeds both route-level permissions and model-policy permissions.
Service Implementation Standards
1. Eloquent-backed domain services
Use this pattern:
- Extend
BaseService - Implement a
...ServiceInterface - Use
CrudOperationsTrait - Inject a repository interface in the constructor
- Keep business-specific methods small and focused
Examples:
src/Services/UserService.phpsrc/Services/ApiProductService.phpsrc/Services/SettingService.php
2. External/Apigee-backed services
Use this pattern:
- Implement a dedicated interface (not
ServiceInterface) - Wrap LaraApigee service calls
- Use consistent error logging via
ReportsServiceFailuresTrait - Emit portal domain events after successful mutations
Examples:
src/Services/UserAppService.phpsrc/Services/UserAppCredentialService.php
Event Naming Standard
Preferred event naming is:
{DomainThing}{Action}Event
Examples:
UserCreatedEventApiProductUpdatedEventUserAppCredentialCreatedEvent
Publishing policy:
...Eventis the canonical and only supported class name- do not add no-suffix event classes
FireEventsTrait dispatches the ...Event class only.
Credential-related events may include credentialKey when the operation targets a
specific credential (approve/revoke/delete/product mutations). Generated-key events
include it when the upstream Apigee client returns the created key.
App-Level Wiring (Listeners / Observers)
The package publishes an app provider stub:
App\Providers\NinjaPortalServiceProvider
Use it to wire project-specific listeners/observers (for example syncing users to Apigee on create/update).
Testing And Static Checks (Package)
After installing package dev dependencies:
composer install
composer test
composer analyse
composer format
Known Tradeoffs (Current)
- Migration rollback safety is not guaranteed for every migration path.
- Demo seeders are intended for one-time/demo environments and are not guaranteed to be re-runnable.
restore()is only supported for models using EloquentSoftDeletes; other models will throw a clear exception ifrestore()is called.
ninjaportal/portal 适用场景与选型建议
ninjaportal/portal 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「apigee」 「lordjoo」 「laravel-apigee」 「apigee-php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ninjaportal/portal 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ninjaportal/portal 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ninjaportal/portal 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Client library for connecting to the Apigee Edge API.
To be used for queueing mock API responses for the `apigee/apigee-client-php` library.
REST API Package for Phalcon PHP
Alfabank REST API integration
This is my package laraapigee
Laravel package for Accurate Online API integration.
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-28