Download the PHP package vaened/laravception without Composer

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

Laravception

Build Status

Laravception standardizes error responses in Laravel, ensuring all exceptions have a unique code, clear message, and metadata. It supports error message translation, promotes specific exception classes, and adapts details based on the environment.

Carbon source code

Installation

Laravception requires PHP 8.2. To get the latest version, simply require the project using Composer:

Now. Publish the configuration file.

Usage

Laravception captures exceptions thrown by the application and standardizes their structure. The unified structure is as follows:

This structure will hide certain details based on whether the environment is set to development or production.

Translations

To enable exception translation, implement the interface TranslatableException. This is sufficient to start translating child exceptions.

It’s recommended to create a custom exception class for each error to allow more specific translations. For example, with the exception “InvalidCreditCardException”, you can have a translation entry in the exceptions file:exceptions:

This functionality is enabled by default. Any exceptions that do not implement Codeable will be treated in the same manner, converting the class name to snake_case and using this transformation as the error code and key for the translation.

For better error code management, you can implement Codeable. In the exception "InvalidCreditCardException", you can return a custom error code such as payments.invalid_credit_card, and in your translation file:

You can also add parameters by implementing the Parametrizable interface. Return an array with the properties to be used, and your translation file will look like this:

We can finally have this implementation:

Configuration

To understand the various configuration options, please refer to the comments in the configuration file laravception.php.

Principles

The core idea behind this library is to standardize error messages in a Laravel project, ensuring that all exceptions follow a common structure.

Specific Exceptions

To improve API organization and documentation, it is recommended to create custom exceptions with a specific purpose, such as "PaymentFailedException" or "ClientNotFoundException" This allows for more precise and effective handling of exceptions.

Translation of Messages

With specific exceptions, presenting error messages can be automated using unique codes. This makes it easier to translate and decorate error messages, ensuring they are clear and useful for both developers and end-users.

License

This library is licensed under the MIT License. For more information, please see the license file.


All versions of laravception with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^10.21|^v11.15
vaened/support Version ^4.0
lambdish/phunctional Version ^2.1
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 vaened/laravception contains the following files

Loading the files please wait ....