buri/nette-autoload-services

此包已被弃用且不再维护。没有建议的替代包。

从各自的目录自动加载并标记服务

v1.1.1 2018-11-09 08:03 UTC

This package is auto-updated.

Last update: 2024-04-09 19:58:33 UTC


README

将自动加载服务加载到 nette 容器

要求

Buri/nette-autoload-services 需要 PHP 7.0 或更高版本。

安装

安装 Buri/nette-autoload-services 的最佳方式是使用 Composer

$ composer require buri/nette-autoload-services

文档

您可以使用 neon 配置文件启用此扩展。

extensions:
	serviceAutoload: Buri\NAS\DI\Extension\AutoloadingExtension

您必须将此扩展放在任何将受益于自动加载的其他扩展之前(例如,Kdyby/Console)

配置

此扩展创建新的配置部分 serviceAutoload,无需最小配置。默认情况下,它提供了对以下内容的支持

如果您想注册自己的目录以进行服务自动加载,以下是一个示例

serviceAutoload:
	consoleCommands:                  # Group name must be present, but can be any valid neon identifier
		directory: %appDir%/Console     # Directory to search in, recursively (string or string[])
		mask:                           # Filename mask, only matching files will be scanned for classes (string or string[])
			- *Command.php
		tag: kdyby.console.command      # Optional, can be used to tag services (string or string[])