PHP code example of buddyad / sendy-laravel
1. Go to this page and download the library: Download buddyad/sendy-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/ */
buddyad / sendy-laravel example snippets
'providers' => [
// ...
'BuddyAd\Sendy\SendyServiceProvider',
]
'aliases' => [
// ...
'Sendy' => 'BuddyAd\Sendy\Facades\Sendy',
]
return [
'listId' => '',
'installationUrl' => '',
'apiKey' => '',
];
$data = [
'email' => '[email protected] ',
'name' => 'John Doe',
'any_custom_column' => 'value',
];
Sendy::subscribe($data);
['status' => true, 'message' => 'Subscribed']
['status' => true, 'message' => 'Already subscribed']
['status' => false, 'message' => 'The error message']
$email = '[email protected] ';
Sendy::unsubscribe($email);
['status' => true, 'message' => 'Unsubscribed']
['status' => false, 'message' => 'The error message']
$email = '[email protected] ';
Sendy::status($email);
Sendy::count();
#To check other list:
Sendy::setListId($list_id)->count();
$campaignOptions = [
'from_name' => 'My Name',
'from_email' => '[email protected] ',
'reply_to' => '[email protected] ',
'title' => 'My Campaign',
'subject' => 'My Subject',
'list_ids' => '1,2,3', // comma-separated, optional
'brand_id' => 1,
'query_string' => 'utm_source=sendy&utm_medium=email&utm_content=email%20newsletter&utm_campaign=email%20newsletter',
];
$campaignContent = [
'plain_text' => 'My Campaign',
'html_text' => View::make('mail.my-campaign'),
];
$send = false;
Sendy::createCampaign($campaignOptions, $campaignContent, $send);
Sendy::setListId($list_id)->subscribe($data);
Sendy::setListId($list_id)->unsubscribe($email);
Sendy::setListId($list_id)->status($email);
Sendy::setListId($list_id)->count();
shell
php artisan vendor:publish --provider="BuddyAd\Sendy\SendyServiceProvider"