承接 commitglobal/enum-utils 相关项目开发

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

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

commitglobal/enum-utils

Composer 安装命令:

composer require commitglobal/enum-utils

包简介

Collection of PHP utilities for working with enums

README 文档

README

GitHub contributors GitHub last commit License: MPL 2.0

Collection of utilities for working with enums.

Contributing | Install | Usage | Feedback | License | About Code for Romania

Contributing

This project is built by amazing volunteers and you can be one of them! Here's a list of ways in which you can contribute to this project. If you want to make any change to this repository, please make a fork first.

Help us out by testing this project in the [staging environment][link-staging]. If you see something that doesn't quite work the way you expect it to, open an Issue. Make sure to describe what you expect to happen and what is actually happening in detail.

If you would like to suggest new functionality, open an Issue and mark it as a [Feature request]. Please be specific about why you think this functionality will be of use. If you can, please include some visual description of what you would like the UI to look like, if you are suggesting new UI elements.

Install

composer require commitglobal/enum-utils

Usage

Arrayable

Important

For Arrayable::options(), your enum must implement a getLabel() method.

Method Description
names() Returns an array of enum case names.
values() Returns an array of enum case values.
options() Returns an associative array mapping values to labels.
enum Status: string
{
    use CommitGlobal\Enums\Concerns\Arrayable;

    case ACTIVE = 'active';
    case INACTIVE = 'inactive';

    public function getLabel(): string
    {
        return match($this) {
            self::ACTIVE => 'Account is active',
            self::INACTIVE => 'Account is inactive',
        };
    }
}
Status::names();   // ['ACTIVE', 'INACTIVE']
Status::values();  // ['active', 'inactive']
Status::options(); // ['active' => 'Account is active', 'inactive' => 'Account is inactive']

Comparable

Method Description
is($enum) Check if this enum matches the given enum instance or value.
isNot($enum) Check if this enum does't match the given enum instance or value.

Example

enum Status: string
{
    use CommitGlobal\Enums\Concerns\Comparable;

    case ACTIVE = 'active';
    case INACTIVE = 'inactive';
}
$status = Status::ACTIVE;

$status->is(Status::ACTIVE);   // true
$status->is('active');         // true
$status->is(Status::INACTIVE); // false
$status->isNot('inactive');    // true

Feedback

  • Request a new feature on GitHub.
  • Vote for popular feature requests.
  • File a bug in GitHub Issues.
  • Email us with other feedback contact@code4.ro

License

This project is licensed under the MPL 2.0 License - see the LICENSE file for details

About Code for Romania

Started in 2016, Code for Romania is a civic tech NGO, official member of the Code for All network. We have a community of around 2.000 volunteers (developers, ux/ui, communications, data scientists, graphic designers, devops, it security and more) who work pro-bono for developing digital solutions to solve social problems. #techforsocialgood. If you want to learn more details about our projects visit our site or if you want to talk to one of our staff members, please e-mail us at contact@code4.ro.

Last, but not least, we rely on donations to ensure the infrastructure, logistics and management of our community that is widely spread across 11 timezones, coding for social change to make Romania and the world a better place. If you want to support us, you can do it here.

commitglobal/enum-utils 适用场景与选型建议

commitglobal/enum-utils 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.09k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 07 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 commitglobal/enum-utils 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 commitglobal/enum-utils 我们能提供哪些服务?
定制开发 / 二次开发

基于 commitglobal/enum-utils 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MPL-2.0
  • 更新时间: 2025-07-22