Download the PHP package rohan0793/jsend without Composer

On this page you can find all versions of the php package rohan0793/jsend. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package jsend

Build Status Scrutinizer Code Quality Build Status

jsend

This is a simple composer package to issue JSend responses from a Laravel 5 application.

To read about JSend, go through this guide

Installation

Require the package through composer:

composer require rohan0793/jsend

Add the service provider to the provider's array in your app.php config file:

RC\JSend\ResponseMacroServiceProvider::class,

Basic Example

Output:

Resource Fetched Example

Output:

The resource fetched macro is defined for ease and readability. It is calling the underlying JSend macro itself. The message, status and code will be filled automatically as success, Resource Fetched Successfully, and 200 respectively. This can useful in removing duplicated code when you have many routes for fetching different resources.

Resource Updated Example

Similar to resource_fetched we have resource updated. The message, status and code will be filled automatically as success, Resource Updated Successfully, and 200 respectively.

Resource Created Example

Similar to resource_fetched we have resource_created. The message, status and code will be filled automatically as success, Resource Created Successfully, and 201 respectively.

Resource Deleted Example

The resource_deleted is a little special. It will output code 204 No Content. According to HTTP code specifications, it will have no output at all.

JSend Error Example

Finally, we have the jsend_error macro which is basically used to respond when there has been an error. It takes an exception as the first argument. It will output code and message from the exception itself. If custom message and code is passed, they will be output instead.

Presenter

Other than the basic response macros with messages and codes, this package also supports presenters. You can build your own presenters. The package will automatically call the present() method on the presenter passed. The recommended approach is using Fractal Package from The PHP League. This package provides very powerful data transforming and presenting capabilities. The documentation is extensive and easy to read and understand.


All versions of jsend with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rohan0793/jsend contains the following files

Loading the files please wait ....