yauhenko/rest-bundle 问题修复 & 功能扩展

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

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

yauhenko/rest-bundle

Composer 安装命令:

composer require yauhenko/rest-bundle

包简介

REST and TypeScript generator for Symfony 6

README 文档

README

Step 1: Run

composer req yauhenko/rest-bundle

Step 2: Add to config/routes/annotations.yaml two lines:

rest_bundle:
    resource: '@RestBundle/config/routes.yaml'

It will register /docs routes

Step 3: Create Types class in src/Types.php:

<?php

namespace App;

use Yauhenko\RestBundle\TypesInterface;
use Yauhenko\RestBundle\Service\TypeScript;

class Types implements TypesInterface {

    public static function registerTypes(TypeScript $ts): void {
        // register custom types here (optional)
        $ts->registerTypeOf('TBadge', ['notifications', 'shop']);
        
        // register interfaces
        $ts->registerInterfacesFromDir(__DIR__ . '/Entity');
        $ts->registerInterfacesFromDir(__DIR__ . '/Models');
    }
    
    public static function codePostProcessor(string $code): string {
        // change generated TypeScript code here (optional)	
        return $code;
    }

}

You can change path to Types class using yauhenko.rest.types_class parameter in config/services.yaml

Step 4 (optional): Configure config/services.yaml:

parameters:
    # Enable TypeScript generation (default: true)
    yauhenko.rest.ts_enabled: '%env(bool:API_TS_ENABLED)%'
    
    # Types class (default) 
    yauhenko.rest.types_class: 'App\Types'
    
    # Path to controllers (default) 
    yauhenko.rest.controllers_dir: '%kernel.project_dir%/src/Controller'

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固