xternalsoft/laravel-patrowl

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

Maintainers

Package info

github.com/XternalSoft/laravel-patrowl

Homepage

pkg:composer/xternalsoft/laravel-patrowl

Fund package maintenance!

xternalsoft

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-05-04 20:57 UTC

This package is auto-updated.

Last update: 2026-05-04 21:09:58 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

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. We publish all received postcards on our virtual postcard wall.

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

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

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 as $asset) {
    echo $asset->value;
}

Managing Assets

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

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

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

Asset Groups

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 all asset groups
$groups = LaravelPatrowl::assetGroups()->all();

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

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

// List all available tags
$tags = LaravelPatrowl::assetTags()->all();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.