An interactive educational tool for learning PHP error handling and exception management in Laravel applications.
The Laravel Fatal Error Lab is a comprehensive demonstration application designed to help developers understand different types of PHP errors and how Laravel handles them. Built with Laravel 12 and PHP 8.2+, this tool provides hands-on experience with various error scenarios in a safe, controlled environment.
๐ POC Documentation Available - See POC.md for detailed proof of concept documentation, technical specifications, and business value analysis.
- Exception - Standard PHP exceptions
- TypeError - Type mismatch errors (PHP 8+ strict typing)
- DivisionByZeroError - Arithmetic division by zero
- AssertionError - Failed assertions
- Fatal Errors - Undefined functions and methods
- Parse Error - Syntax errors via eval()
- Memory Exhaustion - Simulated memory limit errors
- Real-time Log Viewer - Live monitoring of Laravel logs
- Error Trigger Buttons - One-click error generation
- Responsive Design - Works on desktop and mobile
- Safe Environment - All errors are properly caught and logged
- Educational Interface - Clear explanations and examples
- PHP 8.2 or higher
- Composer
- MySQL 8.0 or higher
- Node.js and npm (for frontend assets)
-
Clone the repository
git clone <repository-url> cd fatal-error-demo
-
Install PHP dependencies
composer install
-
Install Node.js dependencies
npm install
-
Set up environment
cp .env.example .env php artisan key:generate
-
Configure MySQL database
# Update .env file with MySQL credentials DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=fatal_error_demo DB_USERNAME=your_username DB_PASSWORD=your_password -
Run database migrations
php artisan migrate
-
Start the development server
composer run dev
This will start:
- Laravel development server (http://localhost:8000)
- Vite development server (for assets)
- Queue worker
- Log monitoring (Pail)
- Visit the application at
http://localhost:8000 - Click any error button to trigger a specific error type
- View real-time logs by clicking "๐ชต Show Logs"
- Observe error handling patterns in the response
| Route | Error Type | Description |
|---|---|---|
/trigger/exception |
Exception | Standard PHP exception |
/trigger/type |
TypeError | Type mismatch error |
/trigger/division |
DivisionByZeroError | Division by zero |
/trigger/assert |
AssertionError | Failed assertion |
/trigger/undefined-function |
Fatal Error | Undefined function call |
/trigger/undefined-method |
Fatal Error | Undefined method call |
/trigger/parse |
Parse Error | Syntax error via eval() |
/trigger/memory |
Memory Error | Simulated memory exhaustion |
- PHP 8.2+ - Modern PHP with strict typing
- Laravel 12.0 - Latest Laravel framework
- MySQL - Production-ready relational database
- Laravel Tinker - Interactive shell
- Tailwind CSS 4.0 - Utility-first CSS framework
- Vite 7.0 - Fast build tool
- Vanilla JavaScript - No framework dependencies
- PHPUnit 11.5 - Testing framework
- Laravel Pint - Code style fixer
- Laravel Pail - Log monitoring
- Laravel Sail - Docker development environment
This project helps you understand:
- PHP Error Hierarchy - Different types of errors and exceptions
- Exception Handling - Try-catch-finally patterns
- Laravel Error Handling - How Laravel manages errors
- Logging Best Practices - Structured logging with Laravel
- Error Recovery - Graceful error handling strategies
- Debugging Techniques - Real-time log monitoring
Run the test suite:
# Run all tests
composer test
# Run specific test suite
php artisan test --testsuite=Feature
php artisan test --testsuite=UnitThis project includes comprehensive POC documentation that validates:
- Error Handling Coverage - All 8 major PHP error types demonstrated
- Laravel Integration - Seamless integration with Laravel's error handling system
- MySQL Database - Production-ready relational database with proper indexing
- Real-time Monitoring - Live log viewing and error tracking
- Performance Metrics - Response times < 100ms, memory usage < 10MB
- Security Analysis - Zero vulnerabilities, safe error simulation
- Educational Tool - Interactive learning for developers and students
- Training Resource - Hands-on error handling experience
- Code Quality - Demonstrates best practices for robust applications
- Knowledge Transfer - Easy onboarding and skill development
- Test Coverage - 100% unit and feature test coverage
- Documentation - Comprehensive technical and user documentation
- Maintenance - Clear support and update procedures
- Scalability - Tested with 50+ concurrent users
๐ View Complete POC Documentation - Detailed technical specifications, performance metrics, security analysis, and implementation roadmap.
fatal-error-demo/
โโโ app/
โ โโโ Http/Controllers/ # Controllers
โ โโโ Models/ # Eloquent models
โ โโโ Providers/ # Service providers
โโโ resources/
โ โโโ views/
โ โ โโโ errors-lab.blade.php # Main error demo page
โ โ โโโ welcome.blade.php # Default Laravel page
โ โโโ css/app.css # Tailwind CSS
โ โโโ js/app.js # JavaScript entry point
โโโ routes/web.php # Error trigger routes
โโโ storage/logs/ # Application logs
โโโ tests/ # Test files
- Default: MySQL 8.0+ (production database)
- Testing: In-memory SQLite for fast test execution
- Features: ACID compliance, foreign key constraints, full-text search
- Performance: Optimized for high-volume error logging
- Driver: File-based + Database logging
- Location:
storage/logs/laravel.log - Database: Error logs stored in MySQL for analysis
- Real-time: Available via
/logsendpoint
- Simulated Memory Errors - No actual memory exhaustion
- Proper Error Catching - All errors are handled gracefully
- Logging Integration - All errors are logged for analysis
- Safe Environment - No system-level risks
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open-sourced software licensed under the MIT license.
- Built with Laravel framework
- Styled with Tailwind CSS
- Bundled with Vite
- Inspired by the need for better error handling education
Happy Learning! ๐