1. Go to this page and download the library: Download xternalsoft/laravel-patrowl 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/ */
// Auto-paginated list of AssetInListData
foreach (LaravelPatrowl::assets()->all(['type' => 'domain'])->items() as $asset) {
echo $asset->value;
echo $asset->thumbnail?->url;
foreach ($asset->relatedTechnologies ?? [] as $technology) {
echo "{$technology->vendor} {$technology->product} {$technology->version}";
}
}
// AssetData in detail (owners, tags, groups, screenshot...)
$asset = LaravelPatrowl::assets()->get($assetId);
echo $asset->criticality->name;
echo $asset->screenshot?->url;
use Xternalsoft\LaravelPatrowl\Data\CreateAssetData;
use Xternalsoft\LaravelPatrowl\Enums\ComplexityEnum;
use Xternalsoft\LaravelPatrowl\Exceptions\AssetAlreadyExistsException;
$data = new CreateAssetData(
value: 'example.com',
organization: 1, // defaults to PATROWL_DEFAULT_ORGANIZATION_ID
description: 'My new asset',
criticality: ComplexityEnum::High,
tags: [12, 34],
owners: [5]
);
try {
$asset = LaravelPatrowl::assets()->create($data);
} catch (AssetAlreadyExistsException $e) {
$existingAssetId = $e->response->json('data.id');
}
// Partial update (PATCH), returns the updated AssetData
$asset = LaravelPatrowl::assets()->update($assetId, [
'description' => 'Updated description',
'criticality' => 3,
]);
// Update the criticality of several assets at once
$response = LaravelPatrowl::assets()->bulkUpdate([
'asset_ids' => [1, 2, 3],
'criticality' => 2,
]);
// Delete
$response = LaravelPatrowl::assets()->delete($assetId);
// Recompute the asset score
$response = LaravelPatrowl::assets()->refreshScore($assetId);
use Xternalsoft\LaravelPatrowl\Data\AddTagToAssetData;
// Create a tag and link it to the asset (POST /tags/)
$response = LaravelPatrowl::assets()->addTag($assetId, new AddTagToAssetData(
value: 'production',
organization: 1
));
// Replace all the tags of an asset by a list of tag IDs (an empty array removes all tags)
$response = LaravelPatrowl::assets()->syncTags($assetId, [12, 34]);
// Remove one tag
$response = LaravelPatrowl::assets()->removeTag($assetId, $tagId);
$result = LaravelPatrowl::assets()->move($assetId, $targetOrganizationId);
$result->asset; // AssetData created in the target organization
$result->createdTags; // tags that did not exist in the target organization and were created
$result->failedTags; // tags that could not be created (the asset is moved without them)
$result->sourceDeleted;
$result->sourceOwners; // owners and groups of the source asset, NOT copied
$result->sourceGroups;
// Keep the source asset
$result = LaravelPatrowl::assets()->move($assetId, $targetOrganizationId, deleteSource: false);
// Auto-paginated list of AssetGroupInListData
foreach (LaravelPatrowl::assetGroups()->all()->items() as $group) {
echo $group->title;
echo $group->vulnsBySeverity['critical'] ?? 0;
}
// AssetGroupData in detail
$group = LaravelPatrowl::assetGroups()->get($groupId);
echo $group->counts['assets'] ?? 0;
use Xternalsoft\LaravelPatrowl\Data\CreateAssetGroupData;
use Xternalsoft\LaravelPatrowl\Enums\ComplexityEnum;
$group = LaravelPatrowl::assetGroups()->create(new CreateAssetGroupData(
title: 'My Production Assets',
description: 'Assets in production environment',
organization: 1, // defaults to PATROWL_DEFAULT_ORGANIZATION_ID
criticality: ComplexityEnum::High, //
// Auto-paginated list of RiskInListData
foreach (LaravelPatrowl::risks()->all(['severity' => 4])->items() as $risk) {
echo $risk->title.' ('.$risk->severity->name.')';
}
// RiskData in detail (org_id is ->exportCsv());
// Topics and subtopics
foreach (LaravelPatrowl::risks()->topics()->items() as $topic) {
echo $topic->title.' ('.$topic->slug.')';
}
foreach (LaravelPatrowl::risks()->subtopics()->items() as $subtopic) {
echo $subtopic->title.' ('.$subtopic->slug.')';
}
use Xternalsoft\LaravelPatrowl\Enums\ControlResultEnum;
use Xternalsoft\LaravelPatrowl\Enums\ControlStatusEnum;
// Auto-paginated list of ControlLiteData, filtered
$controls = LaravelPatrowl::controls()->all([
'severity' => 'critical',
'status' => ControlStatusEnum::Finished->value,
]);
foreach ($controls->items() as $control) {
if ($control->result === ControlResultEnum::Impacted) {
// Handle impacted asset controls
}
}
// ControlData in detail (impacted assets and vulnerabilities)
$control = LaravelPatrowl::controls()->get($controlId);
// Assets impacted / potentially impacted by a control (ControlImpactedAssetData, auto-paginated).
// The detail endpoint returns empty assets_impacted/assets_warning: use this method instead.
// Needs an organization: the one set as default on the client, or pass ['org_id' => ...].
foreach (LaravelPatrowl::controls()->assets($controlId)->items() as $asset) {
echo "{$asset->value} ({$asset->controlImpact})"; // e.g. "Warning" or "Impacted"
}
// The organizations you belong to (OrganizationLiteData: id, name, slug, tenantId, tenantName).
// Not paginated: returns an array.
foreach (LaravelPatrowl::organizations()->all() as $organization) {
echo "{$organization->id}: {$organization->name} ({$organization->tenantName})";
}
// OrganizationData in detail (identity, members, profile, features, credits, monitoring)
$organization = LaravelPatrowl::organizations()->get($organizationId);
echo $organization->credits->easm->available;
// Apex domains only, filters are passed as query parameters
foreach (LaravelPatrowl::domains()->all(['is_top_domain' => true])->items() as $domain) {
echo $domain->value;
foreach ($domain->dnsRecords as $record) {
echo "{$record->recordType} {$record->value}";
}
}
// Open TCP services, with their certificate and web servers
foreach (LaravelPatrowl::services()->all(['state' => 'open', 'protocol' => 'tcp'])->items() as $service) {
echo "{$service->value}:{$service->portNumber}";
echo $service->certificate?->isExpired ? 'expired certificate' : '';
foreach ($service->webservers as $webServer) {
echo $webServer->url;
}
}
$service = LaravelPatrowl::services()->get($serviceId);
echo $service->banner;
foreach (LaravelPatrowl::cves()->all(['severity' => 'critical,high', 'is_kev' => true])->items() as $cve) {
echo "{$cve->identifier} {$cve->cvss?->score}";
}
$cve = LaravelPatrowl::cves()->get('CVE-2026-12345');
if ($cve->threatInfo?->isKev) {
foreach ($cve->exploits as $exploit) {
echo $exploit->reference;
}
}
use Saloon\Http\Faking\MockClient;
use Saloon\Http\Faking\MockResponse;
use Xternalsoft\LaravelPatrowl\Facades\LaravelPatrowl;
use Xternalsoft\LaravelPatrowl\Requests\Assets\GetAssetRequest;
LaravelPatrowl::withMockClient(new MockClient([
GetAssetRequest::class => MockResponse::make(['id' => 1, 'value' => 'example.com', /* ... */]),
]));
bash
php artisan patrowl:install
# or
php artisan vendor:publish --tag="laravel-patrowl-config"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.