anax/commons

Anax Commons module, stuff used by several modules.

Installs: 15 358

Dependents: 67

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 1

Language:Makefile

v2.0.14 2020-11-02 22:22 UTC

README

Latest Stable Version Join the chat at https://gitter.im/canax/commons

Build Status CircleCI

Build Status Scrutinizer Code Quality Code Coverage

Maintainability Codacy Badge

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

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

Class, interface, trait

The following classes, interfaces and traits exists.

Exceptions

There are no module specific exceptions supplied by this module.

App injectable

When a class wants to be injectable with $app it should implement the interface AppInjectableInterface which can be implemented by using the trait AppInjectableTrait.

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

When a class wants to be injectable with the service container $di it should implement the interface ContainerInjectableInterface which can be implemented by using the trait ContainerInjectableTrait.

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

We use Semantic Versioning 2.0.0.

License

This software carries a MIT license. See LICENSE.txt for details.

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