PHPackages                             jaspur/localized-exceptions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. jaspur/localized-exceptions

ActiveLibrary[Localization &amp; i18n](/categories/localization)

jaspur/localized-exceptions
===========================

A custom exception handler package for Laravel that provides localized error messages for HTTP exceptions.

v1.5.1(1y ago)6259MITPHPPHP ^8.2

Since Oct 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Jaspur/localized-exceptions)[ Packagist](https://packagist.org/packages/jaspur/localized-exceptions)[ RSS](/packages/jaspur-localized-exceptions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (16)Used By (0)

Jaspur Localized Exceptions ✨
=============================

[](#jaspur-localized-exceptions-)

A custom exception handler package for Laravel that provides localized error messages for HTTP exceptions.

Requirements 📋
--------------

[](#requirements-)

To use this package, you need:

- **PHP**: ^8.2
- **Laravel**: ^11.0

Ensure you have the correct versions installed to avoid compatibility issues.

Installation 📦
--------------

[](#installation-)

To install the package, use Composer:

```
composer require jaspur/localized-exceptions
```

Service Provider ⚙️
-------------------

[](#service-provider-️)

After installation, the service provider will automatically be registered. If you need to manually register it, add the following line to the `providers` array in your `config/app.php`:

```
Jaspur\LocalizedExceptions\LocalizedExceptionsServiceProvider::class,
```

How It Works 🛠️
---------------

[](#how-it-works-️)

This package overrides Laravel's default exception handling to provide localized messages for various HTTP exceptions. It does this by mapping common HTTP exceptions to their respective status codes and returning appropriate localized messages.

### Exception Mapping

[](#exception-mapping)

The package maps the following exceptions to their respective HTTP status codes:

- **401**: Authentication Failed
- **403**: Authorization Denied
- **404**: Resource Not Found
- **405**: Method Not Allowed
- **406**: Not Acceptable
- **409**: Conflict
- **410**: Gone
- **411**: Length Required
- **412**: Precondition Failed
- **428**: Precondition Required
- **422**: Unprocessable Entity
- **423**: Locked
- **429**: Too Many Requests
- **503**: Service Unavailable
- **415**: Unsupported Media Type

When an exception occurs, the package checks if it matches one of the mapped exceptions and returns a localized message accordingly.

### Validation Errors 📝

[](#validation-errors-)

The package also handles validation exceptions, returning a list of validation errors along with a localized message.

Localization 🌍
--------------

[](#localization-)

You can customize the error messages by creating language files in the `resources/lang/vendor/jaspur` directory. The package loads translations from the `resources/lang` directory.

Publishing Translations 📢
-------------------------

[](#publishing-translations-)

If you want to customize the translation files, you can publish them using:

```
php artisan vendor:publish --tag=lang
```

This will copy the language files to `resources/lang/vendor/jaspur`.

Contributing 🤝
--------------

[](#contributing-)

Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.

License 📝
---------

[](#license-)

This package is licensed under the MIT License.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

15

Last Release

556d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/670ed7058948fc7b475f06ea0d3460f8f4d0ab0e6efa9a0064fcfd342be21611?d=identicon)[Jaspur](/maintainers/Jaspur)

---

Top Contributors

[![Jaspur](https://avatars.githubusercontent.com/u/4254854?v=4)](https://github.com/Jaspur "Jaspur (1 commits)")

### Embed Badge

![Health badge](/badges/jaspur-localized-exceptions/health.svg)

```
[![Health](https://phpackages.com/badges/jaspur-localized-exceptions/health.svg)](https://phpackages.com/packages/jaspur-localized-exceptions)
```

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
