centralapps/application-context 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Create an account factory, which implements LookupInterface, this is used to take an account reference and create an account object. Application specific code.

  2. Create an account context object, pass the server name, the domain name and the account factory

  3. 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);

  4. You can check to see if the application is being ran as an 'account context'

    $account_context->isAccountContext(); // returns true or false

  5. You can also check to see if the account context is valid (that the subdomain matches a real account)

    $account_context->isValidReference();

  6. Finally, you can get the account object, which is retrieved via your pre-defined account factory

    $account = $account_context->getAccount(); // null if not valid

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2013-01-29