joaorbrandao/phenum 问题修复 & 功能扩展

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

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

joaorbrandao/phenum

Composer 安装命令:

composer require joaorbrandao/phenum

包简介

PHP enums made easy.

README 文档

README

This package creates a simple way of creating PHP enums (one more!). Your IDE will detect them without using DocBlocks. In the end, it's all about PHP constants!

Installing

composer require joaorbrandao/phenum

Usage

Create an Enum

  1. Create a class.
  2. Extend the Enum class.
  3. Use the Enumerable trait.
  4. Define PHP constants as needed.
<?php
namespace Acme;

use Joaorbrandao\Phenum\Classes\Enum;
use Joaorbrandao\Phenum\Traits\Enumerable;

class Peripheral extends Enum
{
    use Enumerable;

    const MOUSE = 'mouse';
    const KEYBOARD = 'keyboard';
}

Use it

We're talking about PHP constants, so:

<?php

$mouse = Peripheral::MOUSE;

But in case you need some help like getting all defined values, the first, last, etc:

<?php
$first = Peripheral::first(); // 'mouse'
$last = Peripheral::last(); // 'keyboard'
$exists = Peripheral::exists('mouse'); // true

License

phenum is an open-source package licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固