anax/commons

Anax Commons 模块,被多个模块使用的工具。

安装次数: 15,352

依赖者: 67

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 1

语言: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

存储公共文件的地方,以确保有一个文件的最新版本的中心副本。

此存储库被用于脚手架过程,将文件复制以设置新的安装。该存储库还包含开发文件和各种外部构建工具的配置文件。

该存储库还包含常用的源代码,如接口和特性,这种代码通常在多个 Anax 模块之间共享。

函数

该模块包含一组由多个模块使用的函数。这些函数在 src/functions.php 中可用,并且当使用此模块时将自动加载。

类、接口、特性

以下类、接口和特性存在。

异常

此模块未提供特定于模块的异常。

应用可注入

当类想使用 $app 进行注入时,应实现接口 AppInjectableInterface,该接口可以通过使用特性 AppInjectableTrait 实现。

以下是一个与控制器一起使用时的示例,该控制器可以注入 $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;

查看接口和特性的实际源代码以了解其实现。

容器可注入

当类想使用服务容器 $di 进行注入时,应实现接口 ContainerInjectableInterface,该接口可以通过使用特性 ContainerInjectableTrait 实现。

以下是一个与控制器一起使用时的示例,该控制器可以注入 $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;

查看接口和特性的实际源代码以了解其实现。

版本控制

我们使用 语义版本控制 2.0.0

许可证

此软件采用 MIT 许可证。有关详细信息,请参阅 LICENSE.txt

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