PHP code example of larascope / agent

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

    

larascope / agent example snippets


// config/larascope.php
'stats' => [
    ['label' => 'Liens', 'table' => 'links'],
    ['label' => 'Clics', 'table' => 'clicks'],
],

'logs' => [
    'files' => [
        ['name' => 'security', 'label' => 'Sécurité', 'path' => storage_path('logs/security-*.log')],
        ['name' => 'erp', 'label' => 'ERP', 'path' => storage_path('logs/erp-sync-*.log')],
    ],
],
bash
php artisan larascope:token   # génère un token
dotenv
# Log à parser pour les IP (sinon auto-détection d'un security-*.log)
LARASCOPE_ACCESS_LOG=/var/log/nginx/access.log
LARASCOPE_SCAN_THRESHOLD=50   # IP au-dessus => incident "trafic anormal"