Download the PHP package jftecnologia/laravel-exceptions without Composer
On this page you can find all versions of the php package jftecnologia/laravel-exceptions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jftecnologia/laravel-exceptions
More information about jftecnologia/laravel-exceptions
Files in jftecnologia/laravel-exceptions
Package laravel-exceptions
Short Description Advanced exception management for Laravel with enriched context, multiple logging channels, and user-friendly error messages
License MIT
Homepage https://github.com/jftecnologia/laravel-exceptions
Informations about the package laravel-exceptions
Laravel Exceptions
Advanced exception management system for Laravel with enriched context, multiple logging channels, and customized user-facing messages.
Features
- Custom exceptions with separate messages for developers and end-users
- Enriched context automatically collected (user, host, environment, stack trace)
- Multiple channels for storage (database, etc.)
- Automatic conversion of Symfony HTTP exceptions
- Database logging with complete schema
- Internationalization support (en, es, pt_BR)
- Artisan commands for quick setup and exception generation
Installation
Quick Install (Recommended)
Run the interactive installation command:
This will guide you through publishing assets, migrations, configuration, and running migrations.
After installation, you must register the exception handler in your bootstrap/app.php file:
Note: The LaravelException::handles() call must be placed as the last handler in the withExceptions method to ensure it properly catches all exceptions.
Manual Installation
Important: You must publish the package assets and migrations before using it:
Optionally, publish configuration (if you want to customize it):
Optionally, publish views (if you want to customize them):
After publishing, you must register the exception handler in your bootstrap/app.php file:
Note: The LaravelException::handles() call must be placed as the last handler in the withExceptions method to ensure it properly catches all exceptions.
Usage
Creating Custom Exceptions
Use the artisan command to generate exception classes:
This creates a new exception class in app/Exceptions/PaymentFailedException.php.
Throwing Exceptions
HTTP Exceptions
Available classes: BadRequestHttpException, UnauthorizedHttpException, AccessDeniedHttpException, NotFoundHttpException, MethodNotAllowedHttpException, SessionExpiredHttpException, UnprocessableEntityHttpException, TooManyRequestsHttpException, InternalServerErrorHttpException, ServiceUnavailableHttpException, GatewayTimeoutHttpException.
Cleaning Old Exception Records
Use the clean command to remove old exception records from the database:
The retention period defaults to 365 days but can be configured via the delete_records_older_than_days setting.
Recommended: Schedule this command to run daily by adding it to your routes/console.php:
Configuration
Main options in config/laravel-exceptions.php:
Configuration Options
| Option | Default | Description |
|---|---|---|
view |
laravel-exceptions::error |
Blade view used for displaying exceptions |
convert_exceptions |
true |
Convert unhandled exceptions to AppException automatically |
render_in_debug |
false |
Render custom exception views even when APP_DEBUG=true |
delete_records_older_than_days |
365 |
Number of days to retain exception records (used by clean command) |
context_providers |
Array | Classes that provide additional context for exceptions |
channels |
Array | Storage channels for logging exceptions |
channels_settings |
Array | Channel-specific configuration options |
ignored_exceptions |
Array | Exception classes that should not be logged or converted |
http_exceptions |
Array | Mapping of HTTP status codes to exception classes |
Automatic Context
The package automatically collects:
- Exception: class, message, file, line, code, stack trace
- Application: environment, debug mode
- Host: hostname, IP address
- User: authenticated user ID
- Previous exception: complete information if exists
Database Storage
Exceptions are automatically saved to the exceptions_log table with all relevant fields, making analysis and debugging easier.
Testing
Credits
License
MIT License. See LICENSE.md for details.
All versions of laravel-exceptions with dependencies
illuminate/support Version ^12.0
illuminate/contracts Version ^12.0
illuminate/database Version ^12.0
illuminate/console Version ^12.0