Download the PHP package xternalsoft/laravel-patrowl without Composer
On this page you can find all versions of the php package xternalsoft/laravel-patrowl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xternalsoft/laravel-patrowl
More information about xternalsoft/laravel-patrowl
Files in xternalsoft/laravel-patrowl
Package laravel-patrowl
Short Description A clean, fluent, and developer-friendly PHP wrapper for the Patrowl API
License MIT
Homepage https://github.com/xternalsoft/laravel-patrowl
Informations about the package laravel-patrowl
A clean, fluent, and developer-friendly PHP wrapper for the Patrowl API
A clean, fluent, and developer-friendly PHP wrapper for the Patrowl API. This package allows you to easily interact with assets, asset groups, tags, risks, controls, organizations and EASM resources (domains, IPs, services, CVEs…) of the Patrowl platform from your Laravel application.
Requirements
- PHP 8.4+
- Laravel 12 or 13
- A Patrowl API token (Patrowl API 2.40+)
Installation
You can install the package via composer:
Publish the config file with:
This is the contents of the published config file:
Usage
Configuration
Add your Patrowl settings to your .env file:
| Variable | Description |
|---|---|
PATROWL_API_TOKEN |
Required. Your API token. A MissingApiTokenException is thrown when it is missing. |
PATROWL_API_BASE_URL |
API base URL, defaults to the Patrowl cloud. |
PATROWL_DEFAULT_ORGANIZATION_ID |
Organization sent with most requests (org_id / organization). Many endpoints answer 403 without it: set it to one of the IDs returned by LaravelPatrowl::organizations()->all(). |
PATROWL_PAGINATION_LIMIT |
Page size used by auto-paginated lists (default 100). |
Basic usage
Use the LaravelPatrowl facade:
Outside of Laravel's container (scripts, multiple tokens…), instantiate the connector directly:
Pagination
Every all() method (except organizations()->all()) returns a Saloon Paginator that fetches the next pages automatically. Iterate over items() to get DTOs:
Iterating over the paginator itself (
foreach ($paginator as $page)) yields rawResponseobjects, one per page.
Filters are passed as query parameters (the first argument of all()), using the Patrowl API names.
Error handling
- Methods returning a DTO throw a
LogicExceptionwhen the API answers with an error. The original SaloonRequestException(with the response) is available via$e->getPrevious(). - Paginators throw a Saloon
RequestException(e.g.ForbiddenException) when a page fails. - Methods returning a
Saloon\Http\Response(delete(),addTag(),syncTags()…) do not throw: check$response->successful()/$response->failed().
Assets
List and get assets
Create an asset
Creating an asset from a CIDR range (subnet) is not supported yet: the API returns an asset group instead of an asset.
Update and delete an asset
Manage asset tags
Move an asset to another organization
move() creates the asset in the target organization, then deletes the source:
- Value, description, criticality and exposure are copied. Tags are matched by value in the target organization and created when missing.
- Owners, teams and groups are not copied.
- The source is deleted only if the creation succeeded, and with it its history (findings, score, controls) is lost.
- If the asset already exists in the target organization, an
AssetAlreadyExistsExceptionis thrown and the source is left untouched. - The operation is not atomic: if a tag cannot be created, the asset is still created and the tag is listed in
failedTags.
Asset groups
List and get asset groups
Create an asset group
Update and delete an asset group
Manage the assets and tags of a group
Tags
List tags
tags() lists the tags of the organization (TagData) with a preview of their linked assets and asset groups:
Bulk associate / dissociate tags
Risks
Controls
Organizations
EASM (Attack Surface Management)
Every EASM resource exposes the same read API: all() (auto-paginated) and get(). DTOs live in Xternalsoft\LaravelPatrowl\Data\Easm and match the API payloads exactly, including nested objects.
| Method | Endpoint | all() DTO |
get() DTO |
|---|---|---|---|
domains() |
/domains |
DomainData |
DomainData |
ipv4s() |
/ipv4s |
Ipv4Data |
Ipv4Data |
resolutions() |
/resolutions |
ResolutionData |
ResolutionData |
asns() |
/asns |
AsnData |
AsnData |
services() |
/services |
ServiceData |
ServiceDetailData (with banner) |
webServers() |
/webservers |
WebServerData |
WebServerData |
certificates() |
/certificates |
CertificateData |
CertificateData |
vendors() |
/vendors |
VendorData |
VendorData |
products() |
/products |
ProductData |
ProductData |
technologies() |
/technologies |
TechnologyData |
TechnologyData |
technologyDetections() |
/technology-detections |
TechnologyDetectionData |
TechnologyDetectionData |
cves() |
/cves |
CveData |
CveDetailData (per-version CVSS, EPSS, exploits) |
CVEs are cursor paginated (handled transparently) and retrieved by identifier:
The default organization ID is sent as org_id when configured. Vendors and products are global catalogs and ignore it.
Testing your code
The connector uses Saloon, so you can fake the API in your own tests:
Examples
Runnable scripts for every resource are available in the examples directory.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Upgrading from v1? See the upgrade guide.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Parrot
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-patrowl with dependencies
illuminate/contracts Version ^12.0||^13.0
saloonphp/laravel-plugin Version ^4.0||^5.0
saloonphp/pagination-plugin Version ^2.0
saloonphp/saloon Version ^4.0
spatie/laravel-package-tools Version ^1.16