PHP code example of aiarmada / affiliates

1. Go to this page and download the library: Download aiarmada/affiliates 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/ */

    

aiarmada / affiliates example snippets


Cart::attachAffiliate('AIARMADA42', [
    'utm_source' => 'newsletter',
    'landing_url' => url()->current(),
]);

Cart::hasAffiliate(); // true

Cart::recordAffiliateConversion([
    'external_reference' => 'SO-100234',
    'subtotal' => $order->subtotal_minor, // optional
    'value_minor' => $order->total_minor,
    'total' => $order->total_minor,
]);

$voucher->metadata = [
    'affiliate_code' => 'AIARMADA42',
];

'cookies' => [
    'enabled' => true,
    'name' => 'affiliate_session',
    'ttl_minutes' => 60 * 24 * 30,
    'query_parameters' => ['aff', 'affiliate', 'ref', 'referral'],
    '
bash
composer vendor:publish --tag=affiliates-config
php artisan vendor:publish --tag=affiliates-migrations
php artisan migrate