1. Go to this page and download the library: Download mhrshuvo/journey-log library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mhrshuvo / journey-log example snippets
// Original data with sensitive information
journey_log('payment', 'Processing payment', [
'user_id' => 123,
'amount' => 99.99,
'card_number' => '1234-5678-9012-3456', // Will be masked
'cvv' => '123', // Will be masked
'api_key' => 'sk_live_abc123xyz', // Will be masked
'transaction_id' => 'txn_456789' // Will remain visible
]);
class Api\ProductController extends Controller
{
public function index(Request $request)
{
// Log API product request
journey_log('api-search', 'Mobile app browsed products', [
'platform' => 'mobile',
'app_version' => $request->header('App-Version'),
'user_id' => auth()->id(),
'filters' => $request->all()
]);
return ProductResource::collection(Product::paginate());
}
}
class Api\CartController extends Controller
{
public function store(Request $request)
{
// Log add to cart via API
journey_log('api-cart', 'Mobile user added item to cart', [
'product_id' => $request->product_id,
'quantity' => $request->quantity,
'user_id' => auth()->id(),
'platform' => 'mobile'
]);
return response()->json(['success' => true]);
}
}
// For Web routes - uses sessions + headers
Route::middleware(['web', 'journey-log'])->group(function () {
Route::get('/checkout', [CheckoutController::class, 'index']);
// Other web routes
});
// For API routes - uses headers
Route::middleware(['api', 'journey-log'])->group(function () {
Route::get('/api/products', [ProductController::class, 'index']);
// Other API routes
});