PHPackages                             resultvector/laravel - 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. resultvector/laravel

ActiveLibrary[API Development](/categories/api)

resultvector/laravel
====================

Report conversion events from a Laravel application to the Result Vector API.

v0.1.0(1mo ago)07↓80%MITPHPPHP ^8.4CI passing

Since Jul 10Pushed 1mo agoCompare

[ Source](https://github.com/resultvector/resultvector-laravel)[ Packagist](https://packagist.org/packages/resultvector/laravel)[ Docs](https://github.com/resultvector/resultvector-laravel)[ RSS](/packages/resultvector-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (14)Versions (2)Used By (0)

Result Vector Laravel
=====================

[](#result-vector-laravel)

Laravel integration for reporting server-side conversion events to the Result Vector API.

This package supports one operation: `POST /api/v1/conversions/report` with the `att` and `event` fields. It does not provide browser collectors, attribution management, queues, retries, or other Result Vector APIs.

Requirements
------------

[](#requirements)

- PHP 8.4+
- Laravel 11, 12, or 13

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

[](#installation)

Install the tagged package in a Laravel application:

```
composer require resultvector/laravel
```

Laravel discovers the service provider automatically. Configuration is merged automatically; publishing is optional:

```
php artisan vendor:publish --tag="resultvector-config"
```

Configuration
-------------

[](#configuration)

Add the required API token to the consuming application's `.env` file:

```
RESULTVECTOR_API_TOKEN=your-server-side-api-token
```

Optional values are:

```
RESULTVECTOR_API_URL=https://api.resultvector.com
RESULTVECTOR_TIMEOUT=5
```

The endpoint path is fixed by the package. Runtime code reads the `resultvector` Laravel configuration and does not read environment variables directly.

Usage
-----

[](#usage)

### Safe reporting

[](#safe-reporting)

Use `report()` in normal production workflows. It returns a result and does not interrupt the consuming application's business operation when configuration, transport, or HTTP reporting fails.

Report only after the business operation succeeds:

```
use Illuminate\Http\RedirectResponse;
use ResultVector\Laravel\Facades\ResultVector;

public function store(StoreOrderRequest $request): RedirectResponse
{
    $order = $this->orders->create($request->validated());

    $result = ResultVector::report(
        att: $request->user()?->attribution_token,
        event: 'purchase_completed',
    );

    return to_route('orders.show', $order);
}
```

`att` and `event` are trimmed before submission. The request payload contains exactly:

```
{
  "att": "att_existing_attribution_token",
  "event": "purchase_completed"
}
```

### Strict reporting

[](#strict-reporting)

Use `reportOrFail()` when the caller deliberately needs reporting failures to propagate:

```
use ResultVector\Laravel\Facades\ResultVector;

$result = ResultVector::reportOrFail(
    att: $attributionToken,
    event: 'purchase_completed',
);
```

Both methods return a reported result for any successful 2xx response. Strict reporting propagates missing configuration, connection failures, and unsuccessful HTTP responses. A blank event identifier throws `InvalidArgumentException` because it is a developer error.

Results
-------

[](#results)

`ReportResult` exposes these states:

```
if ($result->wasReported()) {
    // Result Vector accepted the request; statusCode contains the 2xx status.
} elseif ($result->wasSkipped()) {
    // No attribution was available; no HTTP request was made.
} elseif ($result->hasFailed()) {
    // Safe reporting caught an operational failure.
}
```

Missing, empty, or whitespace-only attribution is a normal skipped result and never sends a request. Safe reporting logs a warning with the event, exception type, and sanitized diagnostic message. It never logs the API token or attribution token.

Dependency injection
--------------------

[](#dependency-injection)

Inject the concrete client instead of using the facade when preferred:

```
use ResultVector\Laravel\ReportResult;
use ResultVector\Laravel\ResultVectorClient;

final class CheckoutReporter
{
    public function __construct(private ResultVectorClient $resultVector) {}

    public function report(string $att): ReportResult
    {
        return $this->resultVector->report($att, 'purchase_completed');
    }
}
```

`ResultVectorClient` is registered as a container singleton.

Testing a consuming application
-------------------------------

[](#testing-a-consuming-application)

Use Laravel's HTTP fake; no live network request is required:

```
use Illuminate\Support\Facades\Http;
use ResultVector\Laravel\Facades\ResultVector;

Http::fake(['https://api.resultvector.com/*' => Http::response(status: 202)]);

$result = ResultVector::report('att-test', 'purchase_completed');

expect($result->wasReported())->toBeTrue();
Http::assertSent(fn ($request) => $request->url() ===
    'https://api.resultvector.com/api/v1/conversions/report');
```

Security
--------

[](#security)

This is a server-side package. Keep `RESULTVECTOR_API_TOKEN` in `.env`, do not commit it, and never expose it to browser-side code. The package does not persist attribution tokens or report payloads.

Package verification
--------------------

[](#package-verification)

From the package repository:

```
composer test
composer analyse
composer format
```

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md).

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

[](#contributing)

Contributions are welcome through the [GitHub repository](https://github.com/resultvector/resultvector-laravel). Keep changes focused and include tests for behavior changes.

Security vulnerabilities
------------------------

[](#security-vulnerabilities)

Please report suspected vulnerabilities privately to the maintainers rather than opening a public issue. See the [GitHub repository](https://github.com/resultvector/resultvector-laravel) for the current contact process.

Credits
-------

[](#credits)

Result Vector — [github.com/resultvector/resultvector-laravel](https://github.com/resultvector/resultvector-laravel)

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

Unknown

Total

1

Last Release

48d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a285409b006ba89de745d107769f94e5040624115ab617df7f50a9afb7cf2f92?d=identicon)[resultvector](/maintainers/resultvector)

---

Top Contributors

[![Calaelen](https://avatars.githubusercontent.com/u/524760?v=4)](https://github.com/Calaelen "Calaelen (3 commits)")

---

Tags

laravel-packagephplaravelanalyticsattributionconversion-trackingresultvectorconversion reporting

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5226.7k](/packages/simplestats-io-laravel-client)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.2k12.6M143](/packages/dedoc-scramble)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1614.1k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

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