Download the PHP package dmavrin/laravel-api-exceptions without Composer

On this page you can find all versions of the php package dmavrin/laravel-api-exceptions. 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 laravel-api-exceptions

Laravel-API-Exceptions

All in one solution for exception for JSON REST APIs on Laravel and Lumen.

About

The goal of this package is to provide you with a set of most common exceptions that may be needed while developing JSON REST API. It also:

Installation

PHP 5.4+ or HHVM 3.3+, Composer and Laravel 5.1+ are required.

To get the latest version of Laravel Laravel-API-Debugger, simply add the following line to the require block of your composer.json file.

For Laravel 5.1

For Laravel 5.3

You'll then need to run composer install or composer update to download it and have the autoloader updated.

Once Laravel-API-Exceptions is installed, you need to register the service provider. Open up config/app.php and add the following to the providers key.

Exceptions

Every ApiException can be thrown as a normal exception and they will be automatically serialized to JSON with corresponding HTTP status, if user wants json:

This object will be also populated with trace info, when APP_DEBUG is true.

Also it can have meta attribute when there is additional info. For example for validation errors:

For ValidationApiException, meta attribute has errors object that contains validations errors. Every attribute of this object is a name of a request parameter to validate to and value is an array of errors with description.

Views

Since version 0.3.0 for Laravel 5.3 package can also return html view of the error, if Accept header not equals application/json.

To change included views publish them via:

Handler

Extend your default exceptions handler with:

And remove everything else. Example:

FormRequest

To use FormRequest extend all your Request classes with \Lanin\Laravel\ApiExceptions\Support\Request. It will automatically support validation errors and pass them to the output.

It also has a very handy helper method validatedOnly() that returns from request only those items that are registered in rules method.

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.


All versions of laravel-api-exceptions with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
illuminate/support Version ^5.3
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 dmavrin/laravel-api-exceptions contains the following files

Loading the files please wait ....