assegaiphp/attributes
最新稳定版本:10.1
Composer 安装命令:
composer require assegaiphp/attributes
包简介
A small library defining the core attributes of the AssegaiPHP framework.
README 文档
README
Core PHP attributes for AssegaiPHP applications.
Description
assegaiphp/attributes defines the framework-level metadata attributes shared across AssegaiPHP packages. It is intentionally small and dependency-light: the package only requires PHP 8.4 or newer.
This package is part of the AssegaiPHP 0.9 release line and is consumed by packages such as assegaiphp/core, assegaiphp/common, and assegaiphp/auth through the ^1.0 attributes line.
Installation
Install the package with Composer:
composer require assegaiphp/attributes:^1.0
Available Attributes
Injectable
Use Injectable to mark a class as available to the dependency injector.
<?php use Assegai\Attributes\Enumerations\Scope; use Assegai\Attributes\Injectable; use Assegai\Attributes\ScopeOptions; #[Injectable(new ScopeOptions(scope: Scope::DEFAULT, durable: true))] class HeroService { }
Controller
Use Controller to mark a class as an HTTP controller. The optional host argument accepts a single host or a list of hosts.
<?php use Assegai\Attributes\Controller; #[Controller(path: 'heroes')] class HeroesController { }
Component
Use Component to describe a server-rendered component, including its selector, template, styles, and providers.
<?php use Assegai\Attributes\Component; #[Component( selector: 'app-hero-card', templateUrl: './HeroCardComponent.twig', styleUrls: ['./HeroCardComponent.css'], )] class HeroCardComponent { }
OnException
Use OnException to mark a class or method as an exception handler for one or more exception types.
<?php use Assegai\Attributes\OnException; use RuntimeException; #[OnException(RuntimeException::class)] class RuntimeExceptionHandler { }
ParamAttribute
ParamAttribute is the base class for parameter-oriented attributes. It stores the attribute value supplied by concrete parameter attributes.
<?php use Assegai\Attributes\ParamAttribute; use Attribute; #[Attribute(Attribute::TARGET_PARAMETER)] final class Param extends ParamAttribute { }
More Information
For the full framework guide, visit assegaiphp.com/guide.
统计信息
- 总下载量: 233
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-02