Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JSendResponse Component for HttpFoundation based frameworks (Symfony, Silex, Drupal etc.)

License

Notifications You must be signed in to change notification settings

Junker/JSendResponse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

22 Commits

Repository files navigation

JSendResponse

JSendResponse Component for HttpFoundation based frameworks (Symfony, Silex, Laravel etc.)

Installation

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

php composer.phar require junker/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);
}

About

JSendResponse Component for HttpFoundation based frameworks (Symfony, Silex, Drupal etc.)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

Languages

AltStyle によって変換されたページ (->オリジナル) /