egeatech/laravel-exceptions

A simple package to better handle Exceptions.
4,039 2
Install
composer require egeatech/laravel-exceptions
Latest Version:3.0.1
PHP:^8.0
License:MIT
Last Updated:Jan 9, 2024
Links: GitHub  ·  Packagist
Maintainer: egeatech

Laravel Exceptions

Latest Version on Packagist Total Downloads

A package to help handling exceptions which may occur in your application.

Installation

This package supports Laravel 7, 8 and 9 but requires at least PHP 8.0 starting from v2.x. PHP 7.4 is supported up to version 1.3.0.

Via Composer

$ composer require egeatech/laravel-exceptions

Usage

During the implementation of the business logic of your application, if you wish to throw an exception simply create a new class extending EgeaTech\LaravelExceptions\Exceptions\ApplicationException.

After that, create a new translation file inside your [resources/]lang/en/exceptions folder: the file must be the snake case version of the exception class name. Keep in mind that at least the English form is required.

Now that we're all set, the base exception class will take care of logging the exception in English given its translation key, leaving to the user the choice to return a translated version of the error to the client or, otherwise, return only the exception key for further processes or custom error messages to be displayed.

Change log

Please see the CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

The software is licensed under MIT. Please see the LICENSE file for more information.

Related Packages

graham-campbell/exceptions

Provides A Powerful Error Response System For Both Development And Production

1,298,196 588
kamranahmedse/laravel-faulty

A minimal package to assist in returning RESTful exceptions in your APIs.

20,997 64
bugsnag/bugsnag-laravel

Official Bugsnag notifier for Laravel applications.

37,884,146 902
lanin/laravel-api-exceptions

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

105,718 40
tylercd100/lern

LERN (Laravel Exception Recorder and Notifier) is a Laravel 5 package that will...

154,614 436