定制 artyuum/symfony-jsend-response 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

artyuum/symfony-jsend-response

最新稳定版本:1.2.0

Composer 安装命令:

composer require artyuum/symfony-jsend-response

包简介

JSendResponse component for HttpFoundation based applications (Symfony, Silex, Laravel, Drupal, etc.). It follows the JSend specification, allowing you to give consistent JSON responses to your users.

README 文档

README

JSendResponse component for HttpFoundation based applications (Symfony, Silex, Laravel, Drupal, etc.). It follows the JSend specification, allowing you to give consistent JSON responses to your users.

Note: This repository is a maintened fork of Junker/JSendResponse. See the releases page for modification history.

Requirements

  • PHP ^7.4 || ^8.0
  • Symfony ^5.0 || ^6.0 || ^7.0

Installation

The best way to install JSendResponse is to use a Composer:

composer require artyuum/symfony-jsend-response

Examples

use Junker\JSendResponse\JSendResponse;
use Junker\JSendResponse\JSendSuccessResponse;
use Junker\JSendResponse\JSendFailResponse;
use Junker\JSendResponse\JSendErrorResponse;


class AppController
{
	...

	$data = ['id' => 50, 'name' => 'Waldemar'];
	$message = 'Error, total error!';
	$code = 5;

	return new JSendResponse(JSendResponse::STATUS_SUCCESS, $data);
	// or
	return new JSendResponse(JSendResponse::STATUS_FAIL, $data);
	// or 
	return new JSendResponse(JSendResponse::STATUS_ERROR, NULL, $message);
	// or
	return new JSendResponse(JSendResponse::STATUS_ERROR, $data, $message, $code);
	// or
	return new JSendSuccessResponse($data);
	// or
	return new JSendFailResponse($data);
	// or
	return new JSendErrorResponse($message);
	// or
	return new JSendErrorResponse($message, $code, $data);

}

Contributing

If you'd like to contribute, please fork the repository and make changes as you'd like. Be sure to follow the same coding style & naming used in this library to produce a consistent code.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固