wthealth/laravel-enum-transformer 问题修复 & 功能扩展

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

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

wthealth/laravel-enum-transformer

最新稳定版本:1.1.1

Composer 安装命令:

composer require wthealth/laravel-enum-transformer

包简介

README 文档

README

CI Action Scrutinizer Code Quality Code Coverage

Adds transformation support for bensampo/laravel-enum based enums to the spatie/laravel-typescript-transformer package.

Installation & Configuration

 composer require wthealth/laravel-enum-transformer

Add the following Transformer to the configuration config/type-script-transformer

'transformers' => [
    Webtools\LaravelEnumTransformer\LaravelEnumTransformer::class,
],

Usage

Now any enum created based on BenSampo\Enum\Enum can be transformed to typescript like below

final class UserType extends Enum
{
    const Administrator = 0;
    const Moderator = 1;
    const Subscriber = 2;
    const SuperAdministrator = 3;
}
export type UserType = {
    Administrator = 0,
    Moderator = 1,
    Subscriber = 2,
    SuperAdministrator = 3,
}

Or transform to enums:

This must be enabled in config/type-script-transformer

'transform_to_native_enums' => true,

export enum UserType {
    Administrator = 0,
    Moderator = 1,
    Subscriber = 2,
    SuperAdministrator = 3,
}

Read the documentation for further details.

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-17