Download the PHP package antarctica/laravel-base-exceptions without Composer

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

Laravel Base Exceptions

A set of base PHP exceptions for Laravel applications.

Installing

Require this package in your composer.json file:

Run composer update.

Usage

HttpException

Extends the Symfony HttpException.

This exception is designed for use with APIs or other situations where an error occurs during the processing of HTTP requests.

It extends the Symfony HttpException to ensure easy integration/compatibility with the JSON Exception Formatter package for Laravel.

This exception also adds a number of custom properties used to make using exceptions as errors easier.

Properties

Note: the standard message property is also supported by this exception but not documented here.

statusCode (int)

Sets the HTTP status code to be used in the response, as defined in the parent exception.

headers (int)

Array of headers to be returned in the response, as defined in the parent exception

kind (string)

Human/machine readable error 'type', usually similar to the exception class as this isn't included in errors in a production environment.

details (array)

Free form, but structured 'catch all' for error content. This may be designed for machine or human reading as needed.

For example if you need to include some data that another service should consume or for describing specific validation errors (which wouldn't be suitable to cover in the kind or message properties).

resolution (string)

Human readable, terse description of how to fix the error, if detailed information is needed to achieve this host this externally and include its location in the resolutionURLs property.

resolutionURLs (array)

Human/machine readable list of URLs/URIs relevant to how to fix the error. These may be consumed automatically by a service (i.e. point to another API resource or service) or links to relevant documentation etc. describing how to fix the error in more detail.

Basic usage (Laravel)

InvalidArgumentTypeException

Extends this packages's HttpException exception.

This exception is designed for use with methods where a value used as as a method argument or parameter is determined not to be of the correct data type.

E.g. An argument must be of a data type string but a data type of array is given.

Note: This exception does not require you to determine data types, rather you provide an example of valid value and the given value and there respective types will be determined automatically.

Note: If you need an exception for the actual value being invalid use the InvalidArgumentValueException exception instead.

Note: If you need an exception for ensuring a value is of a particular class (or its parents) do not use this class alone. This class will only confirm the value is an object, it does check its class as well. See BASWEB-157 for details of which exceptions you can use for this purpose.

This exception also adds a number of custom properties used to make using exceptions for this type of error easier.

Properties

Note: the properties used by the HttpException are also supported by this exception but not documented here.

argumentName (string)

Note: This property is required as part of the exception constructor

Used in output messages, the name of whatever argument or parameter in question.

E.g. For a method that requires an argument position to be an integer, the argument name could be Position.

Note: This value is used for constructing display messages within the exception only, therefore its value does not need to match the name of the argument. However as users may use the this value (if used as an API method argument for example) then it is strongly advised to ensure this value does match the argument name.

validArgumentValue (mixed)

Note: This property is required as part of the exception constructor

A known good value, which is of the correct data type for the argument.

E.g. For a method that requires an argument position to be an integer, this value could be any integer value such as 3.

For more complex types such as a method that requires an argument dataProvider to be an object, this value could be any variable that is an object.

givenArgumentType (mixed)

Note: This property is required as part of the exception constructor

The value that was used for the argument. Usually you can simply pass this value through to the exception from the method constructor.

E.g. If the argument is position you can likely use $position for this property.

Basic usage (Laravel)

InvalidArgumentValueException

Extends this packages's HttpException exception.

This exception is designed for use with methods where a value used as as a method argument or parameter is determined not to be of a correct value.

E.g. An argument must be a in a list of three colours Red, Green, Blue and a value of Yellow is given.

Note: If you need an exception for the data type of the value being invalid use the InvalidArgumentTypeException exception instead.

Note: If you need an exception for ensuring a value is of a particular class (or its parents) do not use this class alone. This class will only confirm the value is an object, it does check its class as well. See BASWEB-157 for details of which exceptions you can use for this purpose.

This exception also adds a number of custom properties used to make using exceptions for this type of error easier.

Properties

Note: the properties used by the HttpException are also supported by this exception but not documented here.

argumentName (string)

Note: This property is required as part of the exception constructor

Used in output messages, the name of whatever argument or parameter in question.

E.g. For a method that requires an argument position to be an integer, the argument name could be Position.

Note: This value is used for constructing display messages within the exception only, therefore its value does not need to match the name of the argument. However as users may use the this value (if used as an API method argument for example) then it is strongly recommended to ensure this value does match the argument name.

details (array)

Note: This property is required as part of the exception constructor

Human or machine readable reasons why a value is invalid. Structured as an array to cater to different audiences and purposes.

You may wish to provide well structured information for clients to interpret errors and automatically resolve them or show them to users where the service generating this exception is used as a backing service.

You may also wish to display a descriptive message for use in debugging or other human interactions with the service generating this exception.

Note: It is up to you how complex you make these methods:

resolution (string)

Note: This property is required as part of the exception constructor

This property is inherited from the HttpException but is mandatory for this exception.

A human readable description of how to provide a permitted value. These typically work in tandem with the details parameter.

For example where a method requires an argument to be in a list the details would state that the value given (and display this) is not in the list of valid terms (and list these). The resolution in this case could simply state to retry the previous action using a term from the list of valid terms.

Links to documentation, or other sources/URLs may also be provided through the inherited properties of the HttpException, specifically the resolutionURLs property.

Basic usage (Laravel)

Contributing

This project welcomes contributions, see CONTRIBUTING for our general policy.

Developing

To aid development and keep your local computer clean, a VM (managed by Vagrant) is used to create an isolated environment with all necessary tools/libraries available.

Requirements

[1] SSH config entry

Provisioning development VM

VMs are managed using Vagrant and configured by Ansible.

Committing changes

The Git flow workflow is used to manage development of this package.

Discrete changes should be made within feature branches, created from and merged back into develop (where small one-line changes may be made directly).

When ready to release a set of features/changes create a release branch from develop, update documentation as required and merge into master with a tagged, semantic version (e.g. v1.2.3).

After releases the master branch should be merged with develop to restart the process. High impact bugs can be addressed in hotfix branches, created from and merged into master directly (and then into develop).

Issue tracking

Issues, bugs, improvements, questions, suggestions and other tasks related to this package are managed through the BAS Web & Applications Team Jira project (BASWEB).

Clean up

To remove the development VM:

The laravel-base-exceptions directory can then be safely deleted as normal.

License

Copyright 2014 NERC BAS. Licensed under the MIT license, see LICENSE for details.


All versions of laravel-base-exceptions with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
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 antarctica/laravel-base-exceptions contains the following files

Loading the files please wait ....