PHP code example of codegreencreative / laravel-aweber
1. Go to this page and download the library: Download codegreencreative/laravel-aweber 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/ */
codegreencreative / laravel-aweber example snippets
// Paginate all accounts
// $start integer default 0
// $limit integer default 100 cannot be greater than 100
$accounts = Aweber::accounts()->paginate($start, $limit);
// Load a single account
// $account_id integer
$account = Aweber::accounts()->load($account_id);
// Will return the orignal account object returned by Aweber
$account->account;
// Paginate all broadcasts for a list based on status
// $start integer default 0
// $limit integer default 100 cannot be greater than 100
$broadcasts = Aweber::broadcasts()
->setList($list_id)
->status('draft')
->paginate($start, $limit);
// Load a single broadcast
// $account_id integer
$broadcast = Aweber::broadcasts()
->setList($list_id)
->load($broadcast_id);
// Will return the orignal broadcast object returned by Aweber
$broadcast->broadcast;
// Paginate all campaigns for a list
// $start integer default 0
// $limit integer default 100 cannot be greater than 100
$campaigns = Aweber::campaigns()
->setList($list_id)
->paginate($start, $limit);
// Load a single campaign
// $account_id integer
$campaign = Aweber::campaigns()
->setList($list_id)
->load($campaign_id);
// Will return the orignal campaign object returned by Aweber
$campaign->campaign;
// Paginate all custom fields for a list
// $start integer default 0
// $limit integer default 100 cannot be greater than 100
$custom_fields = Aweber::customFields()
->setList($list_id)
->paginate($start, $limit);
// Load a single custom field
// $account_id integer
$custom_field = Aweber::customFields()
->setList($list_id)
->load($custom_field_id);
// Will return the orignal custom field object returned by Aweber
$custom_field->custom_field;
// Paginate all lists
// $start integer default 0
// $limit integer default 100 cannot be greater than 100
$lists = Aweber::lists()->paginate($start, $limit);
// Load a single list
// $list_id integer
$list = Aweber::lists()->load($list_id);
// Will return the orignal list object returned by Aweber
$list->setList;
// This will return an array containing up to 500 tags
// sorted by descending popularity.
$tags = $list->tags;
// Get total subscribed subscribers for a list
$subscribers = $list->total_subscribed_subscribers;
// Get total subscribers for a list
$subscribers = $list->total_subscribers;
// Get total subscribers subscribed today for a list
$subscribers = $list->total_subscribers_subscribed_today;
// Get total subscribers subscribed yesterday for a list
$subscribers = $list->total_subscribers_subscribed_yesterday;
// Get total unconfirmed subscribers for a list
$subscribers = $list->total_unconfirmed_subscribers;
// Get total unsubscribed subscribers for a list
$subscribers = $list->total_unsubscribed_subscribers;
// Paginate all subscribers on a list
// $start integer default 0
// $limit integer default 100 cannot be greater than 100
$lists = Aweber::subscribers()
->setList($list_id)
->paginate($start, $limit);
// Load a single subscriber
$subscriber = Aweber::subscribers()
->setList($list_id)
->find($subscriber_id);
// Will return the orignal subscriber object returned by Aweber
$list->setList;
// Add a subscriber to a list
$subscriber = Aweber::subscribers()
->setList($list_id)
->add([
'custom_fields' => [
'field' => 'value',
],
'email' => '[email protected]',
'name' => 'Test Test',
'strict_custom_fields' => true,
'tags' => [],
]);
// Move a subscriber from one list to another
$subscriber = Aweber::subscribers()
->setList($list_id)
->load($subscriber_id);
$subscriber->move($destination_list_id);
## Disclaimer
This package does not implement all functions of the Aweber API. Use at your own discretion.
## Contribution Guide
Should you add functionality to this package, please create a pull request. Code additions will only be considered through pull requests.
Code written must be compatible with Laravel 4.1+ and PHP 5.3+.