1. Go to this page and download the library: Download prahsys/laravel-perimeter 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/ */
// In a service provider
Config::set('perimeter.artifacts.root_path',
'perimeter/audits/' . env('CLUSTER_NODE_ID', gethostname())
);
use Illuminate\Support\Facades\Storage;
// List available audit dates
$auditDates = Storage::disk(config('perimeter.artifacts.disk'))
->directories(config('perimeter.artifacts.root_path'));
// Get artifacts for a specific date
$todayArtifacts = Storage::disk(config('perimeter.artifacts.disk'))
->files(config('perimeter.artifacts.root_path') . '/' . now()->format('Y-m-d'));
// Download an artifact file
$artifactContent = Storage::disk(config('perimeter.artifacts.disk'))
->get('perimeter/audits/2025-06-26/2025-06-26_14-30-15_abc123def.zip');
// Configure security alerts in config/logging.php:
'channels' => [
// Send critical security alerts to Slack
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Perimeter',
'emoji' => ':shield:',
'level' => 'critical', // Only critical and above go to Slack
],
// Dedicated security log for compliance
'security' => [
'driver' => 'daily',
'path' => storage_path('logs/security.log'),
'level' => 'info', // Capture all security events
'days' => 90, // Retain logs for compliance purposes
],
// Specialized channel for malware detections
'malware' => [
'driver' => 'daily',
'path' => storage_path('logs/malware.log'),
'level' => 'notice',
],
]
// In your AppServiceProvider or dedicated SecurityServiceProvider
use Prahsys\Perimeter\Facades\Perimeter;
public function boot()
{
// Handle malware detections
Perimeter::onThreatDetected(function ($securityEvent) {
// Notify security team
SecurityTeam::notifyMalwareDetection($securityEvent);
// Quarantine the file
Storage::move(
$securityEvent->location,
"quarantine/{$securityEvent->details['hash']}"
);
});
// Handle vulnerability detections
Perimeter::onVulnerabilityFound(function ($vulnerability) {
// Create ticket in issue tracker
Jira::createSecurityTicket([
'title' => "Security vulnerability: {$vulnerability->description}",
'severity' => $vulnerability->severity,
'details' => $vulnerability->details,
]);
});
// Handle behavioral anomalies
Perimeter::onAnomalyDetected(function ($anomaly) {
// Log IP address for further investigation
if (isset($anomaly->details['source_ip'])) {
SuspiciousActivity::record($anomaly->details['source_ip']);
}
});
}
use Prahsys\Perimeter\Facades\Perimeter;
// Get raw security data with flexible filters
$events = Perimeter::report()
->from(now()->subMonth())
->to(now())
->severity(['critical', 'high'])
->type(['malware', 'vulnerability'])
->get();
// Generate formatted reports for auditors
$report = Perimeter::report()
->from($auditPeriodStart)
->to($auditPeriodEnd)
->format('csv')
->export();
// Generate JSON for API consumption
return Perimeter::report()
->from(request('start_date'))
->to(request('end_date'))
->type(request('event_types', []))
->format('json')
->get();
bash
# Run audit on all enabled services
php artisan perimeter:audit
# Run audit only on specific services
php artisan perimeter:audit --services=clamav,trivy
php artisan perimeter:audit --services=ufw
# Combine with other options
php artisan perimeter:audit --services=clamav,falco --format=json