assegaiphp/attributes
最新稳定版本:10.1
Composer 安装命令:
composer require assegaiphp/attributes
包简介
A small library defining the core attributes of the AssegaiPHP framework.
README 文档
README
A progressive PHP framework for building effecient and scalable server-side applications.
Description
The attributes library is a collection of common PHP 8 attributes that can be used in your Assegai application.
Installation
You can install the package via composer:
$ composer require assegaiphp/attributes
- To check out the guide, visit assegaiphp.com. 📚
Usage
Use the Injectable attribute to mark a class as injectable.
<?php use Assegai\Attributes\Injectable; #[Injectable] class MyService { public function __construct() { // Do something } }
Then you can use your service in your application like this:
<?php use Assegai\Attributes\Controller; use Assegai\Core\Attributes\Http\Get; use Assegai\Core\Attributes\Param; #[Controller('my-controller')] class MyController { public function __construct(protected MyService $myService) { } #[Get] public function findAll(): array { return $this->myService->findAll(); } #[Get(':id')] public function findById(#[Param('id')] int $id) { return $this->myService->findById($id); } }
统计信息
- 总下载量: 63
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-02