bear/package
Composer 安装命令:
composer require bear/package
包简介
BEAR.Sunday application framework package
关键字:
README 文档
README
Overview
BEAR.Sunday is a resource-oriented framework that defines the interfaces and abstractions for the application lifecycle — resource handling, dependency injection, and AOP interception. It does not include concrete implementations for routing, caching, error handling, or compilation.
BEAR.Package is the implementation package for BEAR.Sunday. It provides the production-ready bindings that turn those interfaces into a working application: HTTP routing, DI container compilation, query repository caching, application/vnd.error+json error pages, PSR-3 logging, and context-based module loading.
What This Package Provides
| Concern | Implementation |
|---|---|
| Routing | WebRouter (HTTP), CliRouter (CLI) |
| Error Handling | DevVndErrorPage / ProdVndErrorPage (application/vnd.error+json) |
| Caching | QueryRepository integration, PSR-6 cache |
| Compilation | DI container compiled to PHP scripts, preload file, autoload optimization |
| Logging | PsrLoggerModule (Monolog, PSR-3) |
| Context Modules | ProdModule, ApiModule, CliModule, HalModule |
Architecture
Context-Based DI Binding Override
Instead of switching behavior with a global MODE constant and conditionals, BEAR.Package uses a multi-dimensional context string to compose DI modules. Each segment of the context corresponds to a module, and later modules override the bindings of earlier ones.
For example, the context "prod-api-app" is split by -, reversed, and each segment resolves to a Module class:
app—AppModule(loaded first; base bindings +PackageModule)api—ApiModule(overrides default scheme binding toapp://self)prod—ProdModule(overrides cache, error handler, and compilation bindings)
The framework's behavior changes entirely through binding overrides — no if branches on environment values. Each segment is resolved in order:
- App namespace first:
{AppName}\Module\{Context}Module - Framework fallback:
BEAR\Package\Context\{Context}Module
This allows applications to override any context module while falling back to the framework defaults.
Documentation
Documentation is available at https://bearsunday.github.io/.
bear/package 适用场景与选型建议
bear/package 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 570.16k 次下载、GitHub Stars 达 30, 最近一次更新时间为 2012 年 12 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「aop」 「rest」 「di」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bear/package 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bear/package 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bear/package 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Ray.Di for Laravel
Bootstraps errors and handles them via reporters and renderers
A PSR-7 compatible library for making CRUD API endpoints
Api bundle
AOP interface interoperability
统计信息
- 总下载量: 570.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 20
- 依赖项目数: 27
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-12-11