PHP code example of liveteched / request-logs

1. Go to this page and download the library: Download liveteched/request-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/ */

    

liveteched / request-logs example snippets


$ composer san requestlogs:install
$ php artisan migrate

$startTime = microtime(true);
$response = response()->json([
    'success' => true
]);

$relation = User::find(1);

RequestLogFactory::createForRest($request)
    ->setJsonResponse($response)
    ->setAction('login')
    ->setChannel('client-api')
    ->setExectionTime(microtime(true) - $startTime)
    ->setCustomData([
        'transaction_id' => 'ecfe78cc-10ce-49d2-bb31-29b01da03fc6'
    ])
    ->storeLog($relation);

$wsdlUrl = 'https://api.example.com/soap/V10023.ASMX?WSDL'
$startTime = microtime(true);
$relation = User::find(1);

RequestLogFactory::createForSoap($wdsUrl, $soapClient)
    ->setAction('login')
    ->setChannel('client-soap-api')
    ->setExectionTime(microtime(true) - $startTime)
    ->setCustomData([
        'transaction_id' => 'ecfe78cc-10ce-49d2-bb31-29b01da03fc6'
    ])
    ->storeLog($relation);