jcshoww/php-dictionary

为项目中的字典实体提供基础字典类

1.0.1 2022-04-27 12:29 UTC

This package is auto-updated.

Last update: 2024-09-27 17:36:41 UTC


README

这是一个基础的PHP字典库。字典用于静态数据列表存储。

安装

您可以通过composer安装此包

composer require jcshoww/php-dictionary

使用方法

创建自己的字典并从基础字典类扩展它。以下是一个示例

use Jcshoww\PHPDictionary\Dictionary;

class BindingSideDictionary extends Dictionary
{
    public const FRONT = 1;

    public const BACK = 2;

    public const LEFT = 3;
    
    public const RIGHT = 4;

    /**
     * {@inheritDoc}
     */
    public static function getValues(): array
    {
        return [
            static::FRONT => 'Front',
            static::BACK => 'Back',
            static::LEFT => 'Left',
            static::RIGHT => 'Right',
        ];
    }
}