Download the PHP package desmart/response-exception without Composer

On this page you can find all versions of the php package desmart/response-exception. 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 response-exception

Response Exception

Response exception for Laravel4 is.. exception which returns response.

Install notes

Add desmart/response-exception as a requirement to composer.json:

Update your packages with composer update or install with composer install.

To add error handler add 'DeSmart\ResponseException\ResponseExceptionServiceProvider', to providers in app/config/app.php.

Other way of adding the handler is to add App::error() in app/filters.php:

Just remember to add it after the registration of other App::error() handlers.

Why ?

Let's take a look at desmart/laravel-layout. It's a complex controller calling many actions.

Doing redirects in one of the actions is quite painful. That's because each action returns only a part of bigger response. The only way to return a response which will overwrite the big part is throwing of exception.

That's not the best design (exceptions aren't for that!), but it works and gives a chance to generate complete response from the smallest part of application.

Use cases

This package is useless for standard Laravel applications. Probably it fit's best with desmart/laravel-layout since it's a wicked controller.

Also in some edge cases it can be used for situations when some part of application needs to send own response during controller dispatch.

Examples

The hack

In Laravel response may by returned in many parts of request cycle:

Our hack is using exceptions to take advantage of App::error(). When error handler returns a value that value is treated as a response and is returned to client.

Since throwing an exception breaks normal code execution it's the best way to deliver fast a response.

There's a catch. Every exception is logged to file. The only way to get pass it is to register error handler as the last one. Laravel puts every error handler on top of handlers stack. When one of them returns response the others are not called.


All versions of response-exception with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
illuminate/support Version 4.1.x
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 desmart/response-exception contains the following files

Loading the files please wait ....