anax / commons
Anax Commons 模块,被多个模块使用的工具。
v2.0.14
2020-11-02 22:22 UTC
Requires
- php: ^7.2
Requires (Dev)
- anax/di: ^2.0.0@alpha
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^9
- dev-master
- v2.0.14
- v2.0.13
- v2.0.12
- v2.0.11
- v2.0.10
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v2.0.0-beta.13
- v2.0.0-beta.12
- v2.0.0-beta.11
- v2.0.0-beta.10
- v2.0.0-beta.9
- v2.0.0-beta.8
- v2.0.0-beta.7
- v2.0.0-beta.6
- v2.0.0-beta.5
- v2.0.0-beta.4
- v2.0.0-beta.3
- v2.0.0-beta.2
- v2.0.0-beta.1
- v2.0.0-alpha.8
- v2.0.0-alpha.7
- v2.0.0-alpha.6
- v2.0.0-alpha.5
- v2.0.0-alpha.4
- v2.0.0-alpha.3
- v2.0.0-alpha.2
- v2.0.0-alpha.1
- v1.0.0
This package is auto-updated.
Last update: 2024-08-29 04:48:32 UTC
README
存储公共文件的地方,以确保有一个文件的最新版本的中心副本。
此存储库被用于脚手架过程,将文件复制以设置新的安装。该存储库还包含开发文件和各种外部构建工具的配置文件。
该存储库还包含常用的源代码,如接口和特性,这种代码通常在多个 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