@@ -20,6 +20,7 @@ A production-ready Raw PHP REST API Starter Kit with JWT authentication, user ma
2020- ✅ ** Docker Support** - Containerized deployment
2121- ✅ ** PHPUnit Testing** - Comprehensive test suite
2222- ✅ ** API Documentation** - Complete endpoint docs
23+ - ✅ ** Debug Bar** - Development debugging toolbar with performance monitoring
2324
2425## 📁 Project Structure
2526
@@ -29,6 +30,7 @@ A production-ready Raw PHP REST API Starter Kit with JWT authentication, user ma
2930│ ├── controllers/ # Request handlers
3031│ ├── core/ # Core framework classes
3132│ ├── database/ # Migrations and seeders
33+ │ ├── debugbar/ # Debug bar system
3234│ ├── exceptions/ # Exception handlers
3335│ ├── helpers/ # Utility classes
3436│ ├── middleware/ # Request middleware
@@ -58,6 +60,13 @@ cp .env.example .env
5860# Edit .env with your database credentials
5961```
6062
63+ ** Debug Bar Configuration (Optional)**
64+ ``` bash
65+ # Enable debug bar for development
66+ DEBUGBAR_ENABLED=true
67+ DEBUGBAR_ALLOWED_IPS=127.0.0.1,::1
68+ ```
69+
6170### 3. Database Setup
6271``` bash
6372# Option 1: Import the complete database schema
@@ -185,6 +194,65 @@ The HRMS includes the following tables:
185194- CORS middleware
186195- SQL injection protection (prepared statements)
187196
197+ ## 🔧 Debug Bar
198+
199+ The built-in debug bar provides real-time development insights with minimal performance impact.
200+
201+ ### Features
202+ - ** Performance Monitoring** - Execution time and memory usage tracking
203+ - ** Database Queries** - All SQL queries with timing information
204+ - ** Debug Messages** - Categorized logging (info, warning, error)
205+ - ** Request Data** - HTTP method, URI, headers, and parameters
206+ - ** Custom Timers** - Measure specific code execution times
207+
208+ ### Configuration
209+
210+ Add to your ` .env ` file:
211+ ``` bash
212+ # Enable debug bar (disabled by default)
213+ DEBUGBAR_ENABLED=true
214+
215+ # Optional: Restrict access by IP (comma-separated)
216+ DEBUGBAR_ALLOWED_IPS=127.0.0.1,::1,192.168.1.100
217+ ```
218+
219+ ### Usage
220+
221+ #### Debug Messages
222+ ``` php
223+ // Log debug messages with different levels
224+ debug('User login attempt', 'info');
225+ debug('Invalid credentials', 'warning');
226+ debug('Database connection failed', 'error');
227+ ```
228+
229+ #### Performance Timing
230+ ``` php
231+ // Measure execution time
232+ timer_start('api_call');
233+ // ... your code ...
234+ timer_stop('api_call');
235+ ```
236+
237+ #### Automatic Features
238+ - ** Database Queries** : All PDO queries are automatically tracked
239+ - ** Memory Usage** : Current and peak memory consumption
240+ - ** Request Info** : HTTP method, URI, headers automatically captured
241+
242+ ### Output Modes
243+
244+ ** HTML Pages** : Debug toolbar appears at the bottom of the page
245+ ** JSON APIs** : Debug data included in ` X-Debugbar-Data ` response header (Base64 encoded JSON)
246+
247+ ### Security
248+ - Automatically disabled when ` DEBUGBAR_ENABLED=false `
249+ - IP whitelist support for production-like environments
250+ - No sensitive data exposure (credentials are filtered)
251+ - Zero performance impact when disabled
252+
253+ ### Test Debug Bar
254+ Visit ` http://localhost:8000/welcome ` to see the debug bar in action.
255+
188256## 🧪 Testing
189257
190258``` bash
0 commit comments