定制 assegaiphp/attributes 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

assegaiphp/attributes

最新稳定版本:10.1

Composer 安装命令:

composer require assegaiphp/attributes

包简介

A small library defining the core attributes of the AssegaiPHP framework.

README 文档

README

Assegai Logo

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

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-02