1. Go to this page and download the library: Download coderflexx/laravel-sendy 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/ */
coderflexx / laravel-sendy example snippets
return [
/*
|--------------------------------------------------------------------------
| Sendy Installation URL
|--------------------------------------------------------------------------
|
| This URL is used to connect to your Sendy installation. It should
| point to the root of your Sendy installation. For example:
| https://your-sendy-installation.com
*/
'sendy_installation_url' => env('SENDY_INSTALLATION_URL', 'https://your-sendy-installation.com'),
/*
|--------------------------------------------------------------------------
| Sendy API Key
|--------------------------------------------------------------------------
|
| This key is used to authenticate your application with the Sendy
| installation. You can find your API key in the Sendy settings.
| Make sure to keep this key secure and do not share it with anyone.
| It is recommended to use environment variables to store sensitive
| information like API keys. You can set the SENDY_API_KEY
*/
'sendy_api_key' => env('SENDY_API_KEY', 'your-sendy-api-key'),
];
use Coderflex\LaravelSendy\Facades\Sendy;
$sendy = Sendy::{$service()}->{$action()}
$promise = Sendy::subscribers()->subscribe(
data: $data,
async: true // The request is deferred and returns a promise
);
// perform other tasks/operation here
// later, wait for the response when you're ready.
$response = $promise->await();
use Coderflex\LaravelSendy\Facades\Sendy;
$response = Sendy::brands()->get();
use Coderflex\LaravelSendy\Facades\Sendy;
$data = [
'subject' => 'Test Subject',
'from_name' => 'John Doe',
'from_email' => '[email protected]',
'reply_to' => '[email protected]',
'title' => 'Test Title',
'plain_text' => 'This is a plain text version of the email.',
'html_text' => '<h1>This is a HTML version of the email.</h1>',
'list_ids' => 'abc123',
'segment_ids' => 'xyz456',
'exclude_list_ids' => null,
'exclude_segment_ids' => null,
'brand_id' => '123',
'query_string' => null,
'track_opens' => 1,
'track_clicks' => 1,
'send_campaign' => 1, // if set to 1 the compaign will be created & sent.
'schedule_date_time' => null,
'schedule_timezone' => null,
];
$response = Sendy::compaigns()->create(
data: $data,
async: false
);