PHPackages                             anax/commons - 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. [Framework](/categories/framework)
4. /
5. anax/commons

ActiveLibrary[Framework](/categories/framework)

anax/commons
============

Anax Commons module, stuff used by several modules.

v2.0.14(5y ago)015.8k↓100%[1 issues](https://github.com/canax/commons/issues)20MITMakefilePHP ^7.2

Since Aug 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/canax/commons)[ Packagist](https://packagist.org/packages/anax/commons)[ Docs](https://github.com/canax/commons)[ RSS](/packages/anax-commons/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (38)Used By (20)

Anax Commons
============

[](#anax-commons)

[![Latest Stable Version](https://camo.githubusercontent.com/36d6994b08d78d2ca7ab3db9cae10d10fdae53e334b7922e46f11b711056023e/68747470733a2f2f706f7365722e707567782e6f72672f616e61782f636f6d6d6f6e732f762f737461626c65)](https://packagist.org/packages/anax/commons)[![Join the chat at https://gitter.im/canax/commons](https://camo.githubusercontent.com/01b5a7c47c3023e0451ba1f6b0f10ce7f69bd39ff3f093b4fbf9ec3e7a98cf98/68747470733a2f2f6261646765732e6769747465722e696d2f63616e61782f636f6d6d6f6e732e737667)](https://gitter.im/canax/commons?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build Status](https://camo.githubusercontent.com/283bc587dd0b3fd5dc9cb711f9d8898f553388d59cbff7ce310e7ab2e8f04b4c/68747470733a2f2f7472617669732d63692e6f72672f63616e61782f636f6d6d6f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/canax/commons)[![CircleCI](https://camo.githubusercontent.com/276ee8a573046159fc4dab0fb93a6eec9552dac2c15460aacfe5040d484a6213/68747470733a2f2f636972636c6563692e636f6d2f67682f63616e61782f636f6d6d6f6e732e7376673f7374796c653d737667)](https://circleci.com/gh/canax/commons)

[![Build Status](https://camo.githubusercontent.com/7fb20df676af8c3c3863ccc1e2a3e15dc1ca40f018fd324fffb800ffcd73421f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63616e61782f636f6d6d6f6e732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/canax/commons/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/bf6fc1d86c08671ea7f63af42041c35492f255f2665a5dedcca0ba6c4293a72f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63616e61782f636f6d6d6f6e732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/canax/commons/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/6020b14b46c0ca292ed5f232f4fbefbe37152928d8df522bededbde1371c9d3b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63616e61782f636f6d6d6f6e732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/canax/commons/?branch=master)

[![Maintainability](https://camo.githubusercontent.com/17400f586bb02b0570e8b572e0703383d6c7511686aec138847f1ac22c88e0ab/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f38373035653962633061353937653664666239612f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/canax/commons/maintainability)[![Codacy Badge](https://camo.githubusercontent.com/1992a7cb3efd75faeb63e4644abe3536f9a9eb64a0c0defa705b093770a18815/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6333643630663333633062393437613361663132373738386538303062343032)](https://www.codacy.com/app/mosbth/commons?utm_source=github.com&utm_medium=referral&utm_content=canax/commons&utm_campaign=Badge_Grade)

A place to store common files to have one central copy of the latest version of the file.

This repo is used by scaffolding processes which copies files to set upp fresh installations. The repo also contains development files and various configurations files for external build tools.

The repo also contains commonly used sourcecode like interfaces and traits, such code that is usually shared between several Anax modules.

Functions
---------

[](#functions)

The module contains a set of functions that are used by several modules. The functions are available in [`src/functions.php`](src/functions.php) and they are autoloaded when this module is used.

Class, interface, trait
-----------------------

[](#class-interface-trait)

The following classes, interfaces and traits exists.

Class, interface, traitDescription`Anax\Commons\AppInjectableInterface`For classes that wants to be injectable by `$app`.`Anax\Commons\AppInjectableTrait`Implementation of the interface.`Anax\Commons\ContainerInjectableInterface`For classes that wants to be injectable by `$di`.`Anax\Commons\ContainerInjectableTrait`Implementation of the interface.Exceptions
----------

[](#exceptions)

There are no module specific exceptions supplied by this module.

App injectable
--------------

[](#app-injectable)

When a class wants to be injectable with `$app` it should implement the interface [`AppInjectableInterface`](src/Commons/AppInjectableInterface.php) which can be implemented by using the trait [`AppInjectableTrait`](src/Commons/AppInjectableTrait.php).

Here is a sample when used together with a controller which can be injected with `$app`.

```
namespace Anax\Controller;

use Anax\Commons\AppInjectableInterface;
use Anax\Commons\AppInjectableTrait;

/**
 * A sample controller to show how a controller class can be implemented.
 * The controller will be injected with $app if implementing the interface
 * AppInjectableInterface, like this sample class does.
 * The controller is mounted on a particular route and can then handle all
 * requests for that mount point.
 *
 * @SuppressWarnings(PHPMD.TooManyPublicMethods)
 */
class SampleAppController implements AppInjectableInterface
{
    use AppInjectableTrait;

```

Review the source of the actual interface and the trait to investigate their implementation.

Container injectable
--------------------

[](#container-injectable)

When a class wants to be injectable with the service container `$di` it should implement the interface [`ContainerInjectableInterface`](src/Commons/ContainerInjectableInterface.php) which can be implemented by using the trait [`ContainerInjectableTrait`](src/Commons/ContainerInjectableTrait.php).

Here is a sample when used together with a controller which can be injected with `$di`.

```
namespace Anax\Controller;

use Anax\Commons\ContainerInjectableInterface;
use Anax\Commons\ContainerInjectableTrait;

/**
 * A sample controller to show how a controller class can be implemented.
 * The controller will be injected with $di if implementing the interface
 * ContainerInjectableInterface, like this sample class does.
 * The controller is mounted on a particular route and can then handle all
 * requests for that mount point.
 *
 * @SuppressWarnings(PHPMD.TooManyPublicMethods)
 */
class SampleController implements ContainerInjectableInterface
{
    use ContainerInjectableTrait;

```

Review the source of the actual interface and the trait to investigate their implementation.

Versioning
----------

[](#versioning)

We use [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html).

License
-------

[](#license)

This software carries a MIT license. See [LICENSE.txt](LICENSE.txt) for details.

```
 .
..:  Copyright (c) 2013 - 2019 Mikael Roos, mos@dbwebb.se

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity69

Established project with proven stability

 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 ~23 days

Recently: every ~40 days

Total

37

Last Release

2014d ago

Major Versions

v1.0.0 → v2.0.0-alpha.12018-08-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cac244120f54c02a4fb3186b91323f3f0805dd9daefd0babeb4a82a19232faf?d=identicon)[mikael\_roos](/maintainers/mikael_roos)

---

Top Contributors

[![mosbth](https://avatars.githubusercontent.com/u/169550?v=4)](https://github.com/mosbth "mosbth (84 commits)")

---

Tags

frameworkanax

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/anax-commons/health.svg)

```
[![Health](https://phpackages.com/badges/anax-commons/health.svg)](https://phpackages.com/packages/anax-commons)
```

###  Alternatives

[pestphp/pest-plugin-stressless

Stressless plugin for Pest

67792.6k16](/packages/pestphp-pest-plugin-stressless)

PHPackages © 2026

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