Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Patrowl Laravel Package

xternalsoft/laravel-patrowl

Laravel Patrowl integrates the Patrowl security scanning orchestrator with your Laravel application, offering a simple wrapper to configure connections, launch scans, and manage findings so teams can bring automated security monitoring into their existing Laravel workflows.

View on GitHub
Deep Wiki
Context7

Getting Started

This is a v2 major release, so treat the upgrade as a migration rather than a routine dependency bump.

  1. Read UPGRADE.md, the README, and the new examples first. The examples (controls_assets_list.php, controls_warning_by_organization.php, assets_move.php) are the fastest way to see the intended v2 call shapes.

  2. Grep your codebase for the removed/breaking APIs before upgrading:

    grep -rn "organizations()->default\|assets()->replace\|assetTags()->all\|assetTags()->get" app/
    grep -rn "organizations()->all" app/
    grep -rn "relatedTechnologies\|criticality" app/
    
  3. Update the package and reconcile configuration. The DTO layer no longer reads Laravel's config(). If you previously relied on a config value to supply the default organization, set it explicitly on the connector/client instance instead. This also means the package is safer to use outside Laravel, but it changes where the default organization comes from.

  4. First meaningful use case: pull the organization list and feed it into an asset inventory or control-impact report.

    $organizations = $client->organizations()->all(); // OrganizationLiteData[]
    
    foreach ($organizations as $organization) {
        // OrganizationLiteData objects, not raw arrays
        $organization->id;
    }
    
  5. Use controls()->assets($controlId) for impact reporting. The control detail endpoint in API 2.36–2.38 returns empty assets_impacted and assets_warning; this method is the supported way to retrieve them, with auto-pagination.

Implementation Patterns

Organization and asset synchronization

organizations()->all() now returns OrganizationLiteData[]. Update sync jobs to map DTO properties into your models rather than treating the result as raw arrays:

foreach ($client->organizations()->all() as $organization) {
    Organization::updateOrCreate(
        ['patrowl_id' => $organization->id],
        [/* mapped fields */]
    );
}

This is a good place to cache or queue the organization list, since it is typically stable and used to resolve IDs for other calls.

Idempotent asset provisioning

assets()->create() now sends organization and teams as the API requires, and throws AssetAlreadyExistsException on HTTP 208. In day-to-day synchronization jobs, 208 should usually be treated as success:

use YourPackage\Exceptions\AssetAlreadyExistsException;

try {
    $client->assets()->create($createAssetData);
} catch (AssetAlreadyExistsException $e) {
    // Asset already exists; look it up or continue.
}

Do not swallow this exception in interactive code unless you have a clear reconciliation path—it hides genuine duplicate-creation mistakes.

Moving assets between organizations

assets()->move($assetId, $targetOrganizationId, deleteSource: true) recreates an asset in another organization, matching or creating tags, then deletes the source. Use it for tenant migrations or organization restructuring.

Important operational details:

  • Owners, teams, and groups are not copied. The result returns them so you can reassign them deliberately.
  • deleteSource defaults to true. For production migrations, consider calling with deleteSource: false first, verifying the recreated asset and its tags, then deleting the source or re-running with deletion enabled.
  • Make the job idempotent and log the asset ID, source organization, target organization, and the returned ownership/team/group data.

Control impact and warning reporting

Use controls()->assets($controlId) instead of trusting the control detail payload. The method auto-paginates, so it is safe to use directly in report generation:

foreach ($client->controls()->assets($controlId) as $asset) {
    // impacted or potentially impacted asset
}

For organization-level reporting, see controls_warning_by_organization.php in the examples directory.

EASM inventory and enrichment

The new read-only EASM surface covers domains, IPv4s, resolutions, ASNs, services, web servers, certificates, vendors, products, technologies, technology detections, and CVEs. Typical patterns:

  • Nightly jobs that pull EASM entities into local tables for dashboards and joins with assets/controls.
  • Mapping EASM DTOs to Eloquent models or reporting tables; keep the DTO-to-model mapping in one place so API changes are contained.
  • Joining technology detections and CVEs to your asset inventory for exposure reporting.

Because this is read-only, do not build write-back workflows around these endpoints.

Tag maintenance

assets()->addTag() and assets()->removeTag() now use the current API endpoints. Keep tag changes in a dedicated service/job rather than scattering them through controllers. Tag DTOs map assets_count, which is useful for tag-usage reporting.

Gotchas and Tips

  • Removed methods will fail at runtime, not compile time. organizations()->default(), assets()->replace(), and assetTags()->all() / get() are gone. The tag methods were removed because the API no longer serves GET /assets/tags/ and /assets/tags/{id}/, so there is no drop-in replacement for listing tags.
  • organizations()->all() changed return shape. Code that expected a different structure will break. Iterate OrganizationLiteData objects and use their properties.
  • HTTP 208 is an exception now. Catch AssetAlreadyExistsException explicitly; do not let it fail bulk synchronization jobs.
  • CreateAssetGroupData::$criticality is no longer nullable. Always supply a value when creating asset groups; nullable-criticality code paths need updating.
  • AssetInListData::$relatedTechnologies is now an array. Any code doing string concatenation, str_contains, or implicit string conversion on this property will break or emit warnings.
  • DTOs no longer read Laravel config(). This fixes crashes outside Laravel, but it also means the connector's default organization is no longer overridden by config. Set the default organization deliberately on the connector and test jobs that previously depended on ambient config.
  • The control detail payload is misleading for impact data. assets_impacted and assets_warning are empty from the detail endpoint. Always use controls()->assets() for impacted/potentially impacted assets.
  • assets()->move() does not preserve ownership. Owners, teams, and groups are returned in the result but not copied. Build a follow-up step to restore them.
  • Old asset routes return 403/404. If you see those statuses on delete, add-tag, or remove-tag operations, confirm you are on v2 and not calling legacy endpoints directly.
  • Bulk asset updates use the trailing-slash endpoint. Let the package handle this; do not reimplement bulk updates against hand-built URLs.
  • Test outside Laravel if you use the package in CLI tools or workers. The DTO config decoupling is specifically useful there, but your default-organization wiring must be explicit.
  • Pin the version and upgrade deliberately. Given the number of removed methods and return-type changes, upgrade in a branch, run your integration tests against API 2.36–2.38, and exercise the move, create-duplicate, control-assets, and tag flows specifically.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator