PHPackages                             centralapps/application-context - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. centralapps/application-context

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

centralapps/application-context
===============================

Useful set of tools for working with subdomain based web applications

113PHP

Since Feb 25Pushed 13y ago1 watchersCompare

[ Source](https://github.com/CentralApps/ApplicationContext)[ Packagist](https://packagist.org/packages/centralapps/application-context)[ RSS](/packages/centralapps-application-context/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Application Context Processor
=============================

[](#application-context-processor)

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
------------

[](#installation)

Add the project to your composer.json file

```
{
	"require": {
    	"centralapps/application-context": "dev-master"
	}
}

```

Install the project

```
php composer.phar update

```

Usage
-----

[](#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-&gt;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-&gt;isValidReference();
6. Finally, you can get the account object, which is retrieved via your pre-defined account factory

    $account = $account\_context-&gt;getAccount(); // null if not valid

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6132ed4ce3683ee41415742612934b9b6e521288782316250a7ede778711f8bf?d=identicon)[mkpeacock](/maintainers/mkpeacock)

---

Top Contributors

[![mkpeacock](https://avatars.githubusercontent.com/u/437037?v=4)](https://github.com/mkpeacock "mkpeacock (12 commits)")

### Embed Badge

![Health badge](/badges/centralapps-application-context/health.svg)

```
[![Health](https://phpackages.com/badges/centralapps-application-context/health.svg)](https://phpackages.com/packages/centralapps-application-context)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
