PHPackages                             xternalsoft/laravel-patrowl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. xternalsoft/laravel-patrowl

ActiveLibrary[API Development](/categories/api)

xternalsoft/laravel-patrowl
===========================

A clean, fluent, and developer-friendly PHP wrapper for the Patrowl API

v1.3.1(1mo ago)018MITPHPPHP ^8.4CI passing

Since May 4Pushed 1mo agoCompare

[ Source](https://github.com/XternalSoft/laravel-patrowl)[ Packagist](https://packagist.org/packages/xternalsoft/laravel-patrowl)[ Docs](https://github.com/xternalsoft/laravel-patrowl)[ GitHub Sponsors](https://github.com/xternalsoft)[ RSS](/packages/xternalsoft-laravel-patrowl/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (7)Dependencies (34)Versions (12)Used By (0)

A clean, fluent, and developer-friendly PHP wrapper for the Patrowl API
=======================================================================

[](#a-clean-fluent-and-developer-friendly-php-wrapper-for-the-patrowl-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9a4679c3d922c99fb440bbf62b735e5c5be5e3e2f7dc7dbc7418b07036c711c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f787465726e616c736f66742f6c61726176656c2d706174726f776c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xternalsoft/laravel-patrowl)[![GitHub Tests Action Status](https://camo.githubusercontent.com/26385f419e90fb7f6b2e0f2d3579b766693b2d23a5dfb3413585ab5a1a5ccf22/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f787465726e616c736f66742f6c61726176656c2d706174726f776c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/xternalsoft/laravel-patrowl/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/8a0c4a9c3964ab4d28e2fd08056fec358ec4bb83a682a4122b465ac19e74903f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f787465726e616c736f66742f6c61726176656c2d706174726f776c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/xternalsoft/laravel-patrowl/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/dfbe02448c4e987160ad9be490069b1fcff4c138b58b825a434669a2f9b40001/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f787465726e616c736f66742f6c61726176656c2d706174726f776c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xternalsoft/laravel-patrowl)

A clean, fluent, and developer-friendly PHP wrapper for the Patrowl API. This package allows you to easily interact with assets, asset groups, and tags within the Patrowl ecosystem from your Laravel application.

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/9c6a8b14305e6ddd35201928062a31c8bc1d21a6b31691172a323b22b6711b40/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d706174726f776c2e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-patrowl)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require xternalsoft/laravel-patrowl
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="laravel-patrowl-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-patrowl-config"
```

This is the contents of the published config file:

```
return [
    'api_token' => env('PATROWL_API_TOKEN'),
    'base_url' => env('PATROWL_API_BASE_URL', 'https://dashboard.cloud.patrowl.io/api/auth'),
    'timeout' => 30,
    'default_organization_id' => env('PATROWL_DEFAULT_ORGANIZATION_ID'),
    'limit' => env('PATROWL_PAGINATION_LIMIT', 100),
];
```

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="laravel-patrowl-views"
```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

Add your Patrowl API token and base URL to your `.env` file:

```
PATROWL_API_TOKEN=your-api-token
PATROWL_API_BASE_URL=https://dashboard.cloud.patrowl.io/api/auth
PATROWL_DEFAULT_ORGANIZATION_ID=1
```

### Basic Usage

[](#basic-usage)

You can use the `LaravelPatrowl` facade to interact with the API:

```
use Xternalsoft\LaravelPatrowl\Facades\LaravelPatrowl;

// Get all assets
$assets = LaravelPatrowl::assets()->all();

foreach ($assets->items() as $asset) {
    echo $asset->value;
}
```

### Managing Assets

[](#managing-assets)

#### Create an Asset

[](#create-an-asset)

```
use Xternalsoft\LaravelPatrowl\Data\CreateAssetData;

$data = new CreateAssetData(
    value: 'example.com',
    description: 'My new asset',
    organization: 1
);

$asset = LaravelPatrowl::assets()->create($data);
```

#### Add a Tag to an Asset

[](#add-a-tag-to-an-asset)

```
use Xternalsoft\LaravelPatrowl\Data\AddTagToAssetData;

$data = new AddTagToAssetData(
    value: 'production',
    organization: 1
);

$response = LaravelPatrowl::assets()->addTag($assetId, $data);

if ($response->successful()) {
    // Tag added successfully
}
```

#### Remove a Tag from an Asset

[](#remove-a-tag-from-an-asset)

```
$response = LaravelPatrowl::assets()->removeTag($assetId, $tagId);
```

### Risks

[](#risks)

#### List and Get Risks

[](#list-and-get-risks)

```
// List all risks
$risks = LaravelPatrowl::risks()->all();

foreach ($risks->items() as $risk) {
    echo $risk->title . ' (' . $risk->severity->name . ')';
}

// Get a specific risk
$risk = LaravelPatrowl::risks()->get($riskId);
```

#### Export Risks to CSV

[](#export-risks-to-csv)

```
// Export all risks to CSV format
$csvContent = LaravelPatrowl::risks()->exportCsv();

file_put_contents('risks_export.csv', $csvContent);
```

#### List Risk Topics and Subtopics

[](#list-risk-topics-and-subtopics)

```
// List all risk topics
$topics = LaravelPatrowl::risks()->topics();

foreach ($topics->items() as $topic) {
    echo $topic->title . ' (' . $topic->slug . ')';
}

// List all risk subtopics
$subtopics = LaravelPatrowl::risks()->subtopics();

foreach ($subtopics->items() as $subtopic) {
    echo $subtopic->title . ' (' . $subtopic->slug . ')';
}
```

### Asset Groups

[](#asset-groups)

#### Create an Asset Group

[](#create-an-asset-group)

```
use Xternalsoft\LaravelPatrowl\Data\CreateAssetGroupData;

$data = new CreateAssetGroupData(
    title: 'My Production Assets',
    description: 'Assets in production environment',
    organization: 1,
    assets: [123, 456] // List of asset IDs to add after creation
);

$group = LaravelPatrowl::assetGroups()->create($data);
```

#### List and Get Asset Groups

[](#list-and-get-asset-groups)

```
// List all asset groups
$groups = LaravelPatrowl::assetGroups()->all();

// Get a specific group
$group = LaravelPatrowl::assetGroups()->get($groupId);
```

#### Add a Tag to an Asset Group

[](#add-a-tag-to-an-asset-group)

```
use Xternalsoft\LaravelPatrowl\Data\AddTagToAssetData;

$data = new AddTagToAssetData(
    value: 'critical-infrastructure',
    organization: 1
);

$response = LaravelPatrowl::assetGroups()->addTag($groupId, $data);
```

### Asset Tags

[](#asset-tags)

#### List Tags

[](#list-tags)

To retrieve a paginated, filterable list of all tags, use the `tags` method. Passing `'related' => true` returns complete related asset and asset group data:

```
// List all available tags with complete related data
$tags = LaravelPatrowl::assetTags()->tags([
    'related' => true,
]);

foreach ($tags as $tag) {
    echo $tag->value;
    echo $tag->description;

    // View linked assets
    foreach ($tag->assets as $asset) {
        echo $asset['value'];
    }
}
```

#### Bulk Associate Tags with Assets

[](#bulk-associate-tags-with-assets)

To bulk associate multiple tags with multiple assets across an organization:

```
use Xternalsoft\LaravelPatrowl\Data\BulkAssociateTagsData;

$bulkData = new BulkAssociateTagsData(
    assetIds: [2635579],
    tagIds: [4241],
    organizationId: 1815
);

$response = LaravelPatrowl::assetTags()->associate($bulkData);

if ($response->successful()) {
    echo $response->json('message'); // "Associated 1 tags with 1 assets."
}
```

#### Bulk Dissociate Tags from Assets

[](#bulk-dissociate-tags-from-assets)

To bulk dissociate multiple tags from multiple assets (DELETE `/assets/tags/`):

```
$response = LaravelPatrowl::assetTags()->dissociate(
    assetIds: [2635579],
    tagIds: [4241]
);

if ($response->successful()) {
    echo $response->json('message'); // "Dissociated 1 tags from 1 assets."
}
```

#### List Raw Asset Tags

[](#list-raw-asset-tags)

Alternatively, to query the raw tag indices, use:

```
$assetTags = LaravelPatrowl::assetTags()->all();
```

### Controls

[](#controls)

```
// List all controls with auto-pagination
$controls = LaravelPatrowl::controls()->all();

foreach ($controls as $control) {
    echo $control->title;
}

// Get a specific control in detail (including impacted assets and vulnerabilities)
$control = LaravelPatrowl::controls()->get($controlId);

foreach ($control->assetsImpacted as $asset) {
    echo $asset->value;
}
```

#### Filtering Controls

[](#filtering-controls)

You can filter controls and utilize the built-in integer-backed enums:

```
use Xternalsoft\LaravelPatrowl\Enums\ControlStatusEnum;
use Xternalsoft\LaravelPatrowl\Enums\ControlResultEnum;

// Filter controls by severity and status
$controls = LaravelPatrowl::controls()->all([
    'severity' => 'critical',
    'status' => ControlStatusEnum::Finished->value,
]);

foreach ($controls as $control) {
    if ($control->result === ControlResultEnum::Impacted) {
        // Handle impacted asset controls
    }
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Parrot](https://github.com/XternalSoft)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance94

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

7

Last Release

32d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1142472?v=4)[XternalSoft](/maintainers/XternalSoft)[@XternalSoft](https://github.com/XternalSoft)

---

Top Contributors

[![XternalSoft](https://avatars.githubusercontent.com/u/1142472?v=4)](https://github.com/XternalSoft "XternalSoft (47 commits)")

---

Tags

laravelpatrowl

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/xternalsoft-laravel-patrowl/health.svg)

```
[![Health](https://phpackages.com/badges/xternalsoft-laravel-patrowl/health.svg)](https://phpackages.com/packages/xternalsoft-laravel-patrowl)
```

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M113](/packages/dedoc-scramble)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1123.7k](/packages/codebar-ag-laravel-docuware)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

813336.8k3](/packages/defstudio-telegraph)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.8k](/packages/rawilk-profile-filament-plugin)[codebar-ag/laravel-zammad

Zammad integration with Laravel

107.1k](/packages/codebar-ag-laravel-zammad)[lettermint/lettermint-laravel

Official Lettermint driver for Laravel

1190.2k1](/packages/lettermint-lettermint-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
