hamid-re3a/response-transformer 问题修复 & 功能扩展

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

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

hamid-re3a/response-transformer

Composer 安装命令:

composer require hamid-re3a/response-transformer

包简介

Simple transfomer to return Json responses.

README 文档

README

The main purpose of this package is to return the response in the desired way as the frontend development team requested.

Setup:

This is a private package. So, the installation process is completely different. For this purpose, we recorded 2 videos which you can watch to learn how to install this package.

  1. Installation
  2. After installation, register the package service provider in app.php file like other packages.
    • \ResponseTransformerServiceProvider::class
  3. Register the package façade alias in app.php file:
    • 'RTransformer' => ResponseTransformer\Facades\API::class
  4. Finally you can publish the config file:
    • php artisan vendor:publish --tag=transformer-response

Usage:

You can using this package as façade as well as a helper function.

01. Helper Function:

public function index()
{
    $user = User::first();
    return api()->response(200, 'The very first user in the database', $user);
}

02. Facade:

use RTransformer;
public function index()
{
    $user = User::first();
    return RTransformer->response(200, 'The very first user in the database', $user);
}

Response

{
      "status": 200,
      "message": "The very first user in the database",
      "data": [
           {"name": "Hamid Noruzi"}
       ]
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固