定制 tourze/user-tag-contracts 二次开发

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

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

tourze/user-tag-contracts

最新稳定版本:1.0.0

Composer 安装命令:

composer require tourze/user-tag-contracts

包简介

用户标签

README 文档

README

English | 中文

This package provides contracts (interfaces) for user tag systems in Symfony applications.

Installation

composer require tourze/user-tag-contracts

Quick Start

This package provides two main interfaces:

TagInterface

Represents a tag that can be associated with users:

use Tourze\UserTagContracts\TagInterface;

class UserTag implements TagInterface
{
    private string $name;

    public function __construct(string $name)
    {
        $this->name = $name;
    }

    public function getName(): string
    {
        return $this->name;
    }
}

TagLoaderInterface

Provides tag loading functionality for users:

use Tourze\UserTagContracts\TagLoaderInterface;
use Symfony\Component\Security\Core\User\UserInterface;

class DatabaseTagLoader implements TagLoaderInterface
{
    public function loadTagsByUser(UserInterface $user): iterable
    {
        // Load tags from database
        return $this->repository->findTagsByUser($user);
    }
}

Features

  • Simple and extensible tag interface
  • Automatic service configuration with Symfony's dependency injection
  • Support for any user implementation that implements UserInterface
  • Lazy loading support through iterables

Usage

Services implementing TagLoaderInterface are automatically tagged with user-tag.service in the Symfony container, making them easy to discover and use.

Requirements

  • PHP 8.1+
  • Symfony 6.4+

License

MIT

统计信息

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

GitHub 信息

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

其他信息

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