Download the PHP package mhrshuvo/journey-log without Composer
On this page you can find all versions of the php package mhrshuvo/journey-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mhrshuvo/journey-log
More information about mhrshuvo/journey-log
Files in mhrshuvo/journey-log
Package journey-log
Short Description JSON based folder-wise user journey logger for Laravel applications. Track user behavior with organized JSON logs and built-in analytics dashboard.
License MIT
Homepage https://github.com/mhrshuvo/journey-log
Informations about the package journey-log
JourneyLog Laravel Package
JourneyLog is the "Black Box" for your Laravel application. Designed specifically for high-stakes industries like Flight, Bus, and Hotel Reservations or Dropshipping, it creates a secure, organized, and session-isolated audit trail of every user interaction and 3rd-party API response.
Stop digging through massive, messy log files. Start seeing the full story of every booking.
🌟 Why JourneyLog?
In reservation systems, 3rd-party APIs (GDS, Wholesalers, Suppliers) change prices and availability in milliseconds. When a customer claims a price mismatch or a booking fails, you need evidence.
- Session Isolation: Every visitor gets their own unique JSON log file. No mixed data.
- Folder-Wise Logic: Automatically group logs into categories like
/search,/api-responses, or/bookings. - Hybrid Ready: Works seamlessly with Web (Sessions) and Stateless APIs (Headers).
- Security First: Built-in Global Masking recursively hides sensitive PII (passwords, API keys, tokens).
Installation
Server Setup & Permissions
Required Permissions
Ensure your web server user has proper permissions:
Common Server Issues & Solutions
1. Permission Denied Errors
If you see permission errors in logs:
2. SELinux Issues (RHEL/CentOS)
3. Shared Hosting
- Ensure your hosting provider allows directory creation in storage/
- Some shared hosts require 755 permissions instead of 775
- Contact support if you can't create directories
4. Docker Container Issues
Automatic Cleanup Scheduler
The package includes automatic cleanup of old files. Ensure Laravel's scheduler is running:
Manual Cleanup
Configuration
Publish the config file:
Environment Variables
Add to your .env file:
Data Masking
Protect sensitive information by automatically masking specified field names in your logs. The package includes built-in protection for common sensitive fields and allows customization.
Default Protected Fields
The following fields are automatically masked by default:
passwordpassword_confirmationcvvcard_numberapi_keyauth_tokenaccess_tokensecret
Usage Example
Generated Log Output
Nested Data Masking
Masking works recursively through nested arrays:
Customizing Masked Fields
You can customize which fields are masked by modifying the configuration:
config/journeylog.php:
Case-Insensitive Matching
Field matching is case-insensitive, so all of these would be masked:
password,PASSWORD,Password,PaSsWoRdapi_key,API_KEY,Api_Key
Usage
Basic Logging
Example Use Cases
Example 1: Web Application User Journey
Setup Route:
Controller Implementation:
Request Flow:
Example 2: API Application with Mobile App
Setup Route:
Mobile App Implementation:
API Controller Implementation:
Request Flow:
Generated Log Files
Example: /storage/logs/journeys/search/journey-abc123def456.json
Example: /storage/logs/journeys/cart/journey-abc123def456.json
Example: /storage/logs/journeys/checkout/journey-abc123def456.json
Middleware Setup
Journey ID Resolution Priority
The middleware resolves journey IDs in this order for both web and API:
- Header:
X-Journey-ID(works for both web and API) - Session:
journey_id(web routes only) - Generated: Random 12-character string (fallback)
API Usage
For API clients, include the journey ID in headers:
File Structure
Files are organized as:
Troubleshooting
Check Permissions
Enable Fallback Logging
The package automatically falls back to Laravel's default logging if it can't write journey files. Check your application logs:
Debug Mode
Enable debug mode to see permission issues:
Production Deployment Checklist
- [ ] Storage directory exists and is writable
- [ ] Web server user owns storage directory
- [ ] Laravel scheduler is configured in cron
- [ ] SELinux contexts set (if applicable)
- [ ] Cleanup retention period configured appropriately
- [ ] Fallback logging is working (check Laravel logs)
Support
If you encounter permission issues, the package will automatically log errors to Laravel's default log system for debugging.