PHP code example of elvesora / allocora-laravel

1. Go to this page and download the library: Download elvesora/allocora-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elvesora / allocora-laravel example snippets




use Elvesora\Allocora\Laravel\Contracts\ClientInterface;

final class SynchronizePayees
{
    public function __construct(private readonly ClientInterface $allocora) {}

    public function __invoke(): array
    {
        return (array) $this->allocora->payees()->list()->data();
    }
}

use Elvesora\Allocora\Laravel\Client;

$allocora = app(Client::class);
$response = $allocora->products()->show($productId);

use Elvesora\Allocora\Laravel\Facades\Allocora;

$payees = Allocora::payees()->list()->data();

$response = $allocora->revenues()->create([
    'revenue_source_id' => $revenueSourceId,
    'external_id' => 'order-1001',
    'type' => 'sale',
    'amount' => '150.000',
    'currency' => 'USD',
    'occurred_at' => '2026-08-11T10:00:00Z',
    'product_id' => $productId,
]);

$revenue = $response->data();

// Payees
$allocora->payees()->list($query);
$allocora->payees()->show($id);
$allocora->payees()->create($record);
$allocora->payees()->batchCreate($records);
$allocora->payees()->upsert($record);
$allocora->payees()->batchUpsert($records);
$allocora->payees()->update($id, $changes);
$allocora->payees()->batchUpdate($recordsWithIds);

// Products: the same method set, plus archival
$allocora->products()->archive($id);
$allocora->products()->batchArchive($recordsWithIds);

// Immutable revenue records
$allocora->revenues()->list($query);
$allocora->revenues()->show($id);
$allocora->revenues()->create($record);
$allocora->revenues()->batchCreate($records);

// Rules: the payee method set, plus status and version history
$allocora->rules()->toggleStatus($id);
$allocora->rules()->versions($id);

$response->status();
$response->body();
$response->headers();
$response->header('X-Request-Id');
$response->headerLine('Retry-After');
$response->data();
$response->meta();