承接 codamos/tagger 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

codamos/tagger

最新稳定版本:1.0.0

Composer 安装命令:

composer require codamos/tagger

包简介

A simple tagging library inspired by Go's struct tags

README 文档

README

A simple tagging library inspired by Go's struct tags

Source Code Download Package PHP Programming Language Read License (MIT)

About

codamos/tagger is a simple tagging library inspired by Go's struct tags. It allows you to fetch free-form tags from class properties via a Tag attribute that can later be used by third-party libraries or your own code.

The library also includes a tag parser and a class tags scanner. These should allow you to use tagger at scale for your entire application at build time, or at runtime.

Installation

Install this package as a dependency using Composer.

composer require codamos/tagger

Usage

You may use the Tag attribute to annotate your class' properties with free-form tags, split by space characters.

use Codamos\Tagger\Attributes\Tag;
use Codamos\Tagger\Parser\TagParser;
use Codamos\Tagger\Scanner\TagScanner;

class UserDTO
{
    #[Tag('json:"id" orm:"id,primaryKey,autoIncrement"')]}
    public int $id;

    #[Tag('json:"name" orm:"name,notNull,size:255"')]
    public string $name;

    #[Tag('json:"email" orm:"email,notNull,size:255,unique,index"')]
    public string $email;

$parser = new TagParser();
$scanner = new TagScanner($scanner);

$map = $scanner->scan(UserDTO::class);

$emailTags = $map->get('email');
$emailTags->get('json'); // string(json:"email")
$emailTags->get('orm'); // string(orm:"email,notNull,size:255,unique,index")

Copyright and License

The codamos/tagger library is copyright © Codamos and licensed for use under the terms of the MIT License (MIT). Please see LICENSE for more information.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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