PHPackages                             mezon/common-application - 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. mezon/common-application

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

mezon/common-application
========================

Common application for basic purposes

1.1.5(3y ago)23.8k1MITPHPPHP &gt;=7.2.0

Since Feb 18Pushed 3y ago2 watchersCompare

[ Source](https://github.com/alexdodonov/mezon-common-application)[ Packagist](https://packagist.org/packages/mezon/common-application)[ Docs](https://github.com/alexdodonov/mezon-common-application)[ RSS](/packages/mezon-common-application/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (22)Used By (1)

Common application class
------------------------

[](#common-application-class)

### Intro

[](#intro)

This class provides simple application routine with more complex rendering and error handling.

### Extended routes processing

[](#extended-routes-processing)

In [Application](https://github.com/alexdodonov/mezon-application) class routes may return only strings. But CommonApplication class allows you to return arrays of string which will be placed in the template placeholders.

Simple example:

```
class           ExampleApplication extends CommonApplication
{
	/**
	 * Constructor.
	 */
	function			__construct( $template )
	{
		parent::__construct( $template );
	}

    function            actionSimplePage()
    {
        return [
            'title' => 'Route title' ,
            'main' => 'Route main'
        ];
    }
}
```

Here route's handler generates two parts of the page /simple-page/ - 'title' and 'main'. These two part will be inserted into {title} and {main} placeholders respectively.

More complex example:

```
class           ExampleApplication extends CommonApplication
{
	/**
	 * Constructor.
	 */
	function			__construct($template)
	{
		parent::__construct($template);
	}

    function            actionSimplePage()
    {
        return [
            'title' => 'Route title' ,
            'main' => new View('Generated main content')
        ];
    }
}
```

Here we pass instance of the class View (or any class derived from View) to the application page compilator. It will call View::render method which must return compiled html content.

### Routes config

[](#routes-config)

You can also keep al routes in configs. You can use json configs:

```
[
	{
		"route": "/route1/",
		"callback": "route1",
		"method": "GET"
	},
	{
		"route": "/route2/",
		"callback": "route2",
		"method": ["GET","POST"]
	}
]
```

This data must be stored in the './conf/' dir of your project. Or load configs explicitly as shown below (using method loadRoutesFromConfig).

And we also need these methods in the application class.

```
class           ExampleApplication extends CommonApplication
{
	/**
	 * Constructor.
	 */
	function			__construct($template)
	{
		parent::__construct($template);

		// loading config on custom path
		$this->loadRoutesFromConfig('./my-routes.json');
	}

    function            route1()
    {
        return [
            // here result
        ];
    }

    function            route2()
    {
        return [
            // here result
        ];
    }
}
```

Note that you can load multiple configs with one call of the method loadRoutesFromConfigs

```
function			__construct($template)
	{
		parent::__construct($template);

		$this->loadRoutesFromConfigs(['./conf/my/routes.json', './conf/my-routes.php']);
	}
```

Or the same:

```
function			__construct($template)
	{
		parent::__construct($template);

		$this->loadRoutesFromDirectory('./conf');
	}
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

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.

###  Release Activity

Cadence

Every ~24 days

Recently: every ~40 days

Total

21

Last Release

1421d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14943896?v=4)[alexdodonov](/maintainers/alexdodonov)[@alexdodonov](https://github.com/alexdodonov)

---

Top Contributors

[![alexdodonov](https://avatars.githubusercontent.com/u/14943896?v=4)](https://github.com/alexdodonov "alexdodonov (34 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mezon-common-application/health.svg)

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

PHPackages © 2026

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