PHP code example of processhub / laravel-logs
1. Go to this page and download the library: Download processhub/laravel-logs 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/ */
processhub / laravel-logs example snippets
'channels' => [
// … existing channels
'processhub' => [
'driver' => 'custom',
'via' => ProcessHub\Logs\Logging\ProcessHubFactory::class,
'level' => env('LOG_LEVEL', 'warning'),
],
],
'stack' => [
'driver' => 'stack',
'channels' => ['single', 'processhub'],
'ignore_exceptions' => false,
],
use ProcessHub\Logs\Payouts\Payouts;
use App\Models\Payment;
Payouts::register(
model: Payment::class,
map: fn (Payment $p) => [
'gatewayPaymentId' => (string) $p->id, // stable dedup key
'paymentCreatedAt' => $p->created_at->toIso8601String(),
'rawStatus' => $p->status_text, // verbatim, ProcessHub maps it
'isCompleted' => (bool) $p->completed,
'isFatalError' => (bool) $p->fatal_error,
'grossAmount' => (string) $p->amount, // string to keep кoпейки intact
// Optional core ↓
'externalTxnId' => $p->transaction_id,
'gatewayUpdatedAt' => $p->updated_at?->toIso8601String(),
'errorReason' => $p->result_message,
'recipientPhone' => $p->phone,
'recipientName' => $p->fio,
'recipientMaskedCard' => $p->card_masked,
// Anything else ProcessHub-side RAW columns may need ↓
'rawData' => $p->only(['method', 'tochka', 'service']),
],
query: fn ($q) => $q->where('type', 'PR'), // optional scope
);
bash
php artisan processhub:test