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.

Maintainers

Package info

github.com/artyuum/JSendResponse

pkg:composer/artyuum/symfony-jsend-response

Statistics

Installs: 47 466

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

1.3.0 2026-01-17 19:58 UTC

This package is auto-updated.

Last update: 2026-02-17 20:19:17 UTC


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.