centralapps/application-context
Composer 安装命令:
composer require centralapps/application-context
包简介
Useful set of tools for working with subdomain based web applications
关键字:
README 文档
README
This component is designed for use in application which make use of subdomains to segregate data / accounts.
For example, if you have the domain mydomain.com and one of your customers logs in and uses the application via customername.mydomain.com, this component makes it easy to lookup those customers details, and to determine what "context" the application is running in (account context or not). This lets you route and manage the application correctly.
Installation
Add the project to your composer.json file
{
"require": {
"centralapps/application-context": "dev-master"
}
}
Install the project
php composer.phar update
Usage
-
Create an account factory, which implements LookupInterface, this is used to take an account reference and create an account object. Application specific code.
-
Create an account context object, pass the server name, the domain name and the account factory
-
The context will then setup, and store a reference for the account
$account_context = new \CentralApps\ApplicationContext\Context($_SERVER['SERVER_NAME'], 'mydomain.com', $account_factory);
-
You can check to see if the application is being ran as an 'account context'
$account_context->isAccountContext(); // returns true or false
-
You can also check to see if the account context is valid (that the subdomain matches a real account)
$account_context->isValidReference();
-
Finally, you can get the account object, which is retrieved via your pre-defined account factory
$account = $account_context->getAccount(); // null if not valid
centralapps/application-context 适用场景与选型建议
centralapps/application-context 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 1, 最近一次更新时间为 2013 年 01 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Context」 「subdomain」 「web app」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 centralapps/application-context 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 centralapps/application-context 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 centralapps/application-context 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Behat Context for testing Symfony Api
🎉 Finally a subdomain localization that works how you want it to work. 🌐
Context support (request, session and application scope) for n2n framework.
Model of a web-based resource
Retrieve a WebResourceInterface instance over HTTP
Standalone CLI that generates codebase context (JSON + Markdown) for AI agents.
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2013-01-29