PHP code example of stephenjude / laravel-sendportal

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

    

stephenjude / laravel-sendportal example snippets


use SendPortal\Laravel\Contracts\ClientContract;
use SendPortal\Laravel\Facades\SendStack;

/**
 * Without a Facade
 */
$client = app()->make(
    abstract: ClientContract::class,
);

$client->subscribers()->all();


/**
 *  Using the Facade
 */
SendPortal::subscribers()->all();

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::subscribers()->all();

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::subscribers()->get(
    subscriber: 1,
);

use SendPortal\Laravel\Facades\SendPortal;
use SendPortal\Laravel\Http\Requests\SubscriberRequest;

SendPortal::subscribers()->create(
    request: new SubscriberRequest(
        email: '[email protected]', // Required
        firstName: 'Send', // Optional
        lastName: 'Portal', // Optional
        tags: [
            1,
            2,
        ], // Optional
        optOut: false, // Optional
    ),
);

use SendPortal\Laravel\Facades\SendPortal;
use SendPortal\Laravel\Http\Requests\SubscriberRequest;

SendPortal::subscribers()->update(
    id: 1,
    request: new SubscriberRequest(
        email: '[email protected]', // Required
        firstName: 'Send', // Optional
        lastName: 'Portal', // Optional
        tags: [
            1,
            2,
        ], // Optional
        optOut: false, // Optional
    ),
);

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::subscribers()->delete(
    subscriberId: 1,
);

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::subscribers()->attachTag(
    subscriberId: 1,
    tagId: 1,
);

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::subscribers()->removeTag(
    subscriberId: 1,
    tagIds: [1, 2],
);

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::isActiveSubscriber(
    subscriberId: 1,
);

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::tags()->all();

use SendPortal\Laravel\Facades\SendPortal;
use SendPortal\Laravel\Http\Requests\TagRequest;

SendPortal::tags()->create(
    request: new TagRequest(
        name: 'Test', // Required
        subscribers: [1], // Optional
    ),
);