switon/id 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

switon/id

Composer 安装命令:

composer require switon/id

包简介

Named ID generators for UUIDs, ULIDs, Snowflake, and compact public IDs for Switon Framework

README 文档

README

CI PHP 8.3+

Switon's ID generation package for interface-first services that need selectable strategies, sortable identifiers, and compact public IDs.

Highlights

  • Pluggable ID generation: IdGeneratorInterface can be swapped as needed.
  • Named ID strategies: common strategies are ready to use through the service provider.
  • Distributed Snowflake support: sequence allocation can be coordinated through Redis.
  • Time-ordered identifiers: Uuid7, Ulid, and Ksuid produce sortable string IDs.
  • Compact formats: NanoId, Cuid2, ShortUuid, and MongoId cover shorter public IDs.

Installation

composer require switon/id

Quick Start

use Switon\Core\Attribute\Autowired;
use Switon\Id\IdGeneratorInterface;

class OrderService
{
    #[Autowired] protected IdGeneratorInterface $idGenerator;

    public function createOrder(): string
    {
        return (string) $this->idGenerator->next();
    }
}

Docs: https://docs.switon.dev/latest/id

License

MIT.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固