Skip to content
This repository was archived by the owner on Dec 16, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
language: php

dist: trusty
php:
- 5.4
- 5.5
- 5.6
- 7.2
- 7.3
- 7.4
- hhvm

env:
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Constant Contact PHP SDK
[![Build Status](https://secure.travis-ci.org/constantcontact/php-sdk.png?branch=master)](http://travis-ci.org/constantcontact/php-sdk) [![Latest Stable Version](https://poser.pugx.org/constantcontact/constantcontact/v/stable.svg)](https://packagist.org/packages/constantcontact/constantcontact) [![Latest Unstable Version](https://poser.pugx.org/constantcontact/constantcontact/v/unstable.svg)](https://packagist.org/packages/constantcontact/constantcontact)

### This library utilizes [GuzzlePHP](http://guzzle.readthedocs.org/)

## Installing via Composer (recommended)
[Composer](https://getcomposer.org/) is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project. In order to use the Constant Contact PHP SDK through composer, you must add "constantcontact/constantcontact" as a dependency in your project's composer.json file.

[Composer](https://getcomposer.org/) is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project. In order to use the Constant Contact PHP SDK through composer, you must add "yousaf-saqib/cc-php-sdk" as a dependency in your project's composer.json file which is a fork of "constantcontact/constantcontact".
```javascript
{
"require": {
"constantcontact/constantcontact": "2.1.*"
"yousaf-saqib/cc-php-sdk": "1.0.*"
}
}
```
Expand All @@ -25,7 +25,7 @@ API Documentation is located at http://developer.constantcontact.com/docs/develo
## Usage
The ConstantContact class contains the underlying services that hold the methods that use the API.
```php
use Ctct\ConstantContact;
use YousafSaqib\ConstantContact\ConstantContact;
$cc = new ConstantContact('your api key');

$contacts = $cc->contactService->getContacts('your access token')
Expand All @@ -37,6 +37,11 @@ $params = array("limit" => 500);
$contacts = $cc->contactService->getContacts('your access token', $params);
```
## Minimum Requirements
Use of this library requires PHP 5.4+, and PHP cURL extension (http://php.net/manual/en/book.curl.php)
Use of this library requires PHP 7.2+, and PHP cURL extension (http://php.net/manual/en/book.curl.php)

If you are being required to use an older version of PHP, it is highly recommended that you update to at least 7.2 .


## Changes from Orignal Client

If you are being required to use an older version of PHP, it is highly recommended that you update to at least 5.4 - but you can use version 1.3.* via composer, or [manually](https://github.com/constantcontact/php-sdk/tree/v1-master).
- New attribute added in connstant contant campaign tracking activity which contains clicked uri information
28 changes: 19 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
{
"name": "constantcontact/constantcontact",
"name": "yousaf-saqib/cc-php-sdk",
"type": "library",
"description": "Constant Contact PHP SDK for v2",
"keywords": ["constantcontact", "ctct", "email marketing", "constant contact"],
"keywords": [
"constantcontact",
"ctct",
"email marketing",
"constant contact"
],
"homepage": "http://developer.constantcontact.com",
"license": "MIT",
"require": {
"php": ">=5.4.0",
"ext-curl": "*",
"guzzlehttp/guzzle": "^5.1.0"
"guzzlehttp/guzzle": "^7.0",
"ext-curl": "^7.2",
"php": "^7.2"
},
"require-dev": {
"phpunit/phpunit": "4.4.1"
"phpunit/phpunit": "^8.5"
},
"authors": [
{
"name": "Constant Contact Web Services",
"email": "[email protected]",
"homepage": "http://developer.constantcontact.com"
},
{
"name": "Yousaf Saqib",
"email": "[email protected]",
"homepage": "http://developer.constantcontact.com"
}
],
"autoload": {
"psr-0": {
"Ctct": "src"
"psr-4": {
"YousafSaqib\\ConstantContact\\": "src"
}
}
}
}
22 changes: 11 additions & 11 deletions examples/addOrUpdateContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@

<!--
README: Add or update contact example
This example flow illustrates how a Constant Contact account owner can add or update a contact in their account. In order for this example to function
properly, you must have a valid Constant Contact API Key as well as an access token. Both of these can be obtained from
This example flow illustrates how a Constant Contact account owner can add or update a contact in their account. In order for this example to function
properly, you must have a valid Constant Contact API Key as well as an access token. Both of these can be obtained from
http://constantcontact.mashery.com.
-->

<?php
// require the autoloaders
require_once '../src/Ctct/autoload.php';
require_once '../src/autoload.php';
require_once '../vendor/autoload.php';

use Ctct\ConstantContact;
use Ctct\Components\Contacts\Contact;
use Ctct\Exceptions\CtctException;
use YousafSaqib\ConstantContact\Components\Contacts\Contact;
use YousafSaqib\ConstantContact\ConstantContact;
use YousafSaqib\ConstantContact\Exceptions\CtctException;

// Enter your Constant Contact APIKEY and ACCESS_TOKEN
define("APIKEY", "ENTER YOUR API KEY");
Expand Down Expand Up @@ -134,10 +134,10 @@
<div class="controls">
<select name="list">
<?php
foreach ($lists as $list) {
echo '<option value="' . $list->id . '">' . $list->name . '</option>';
}
?>
foreach ($lists as $list) {
echo '<option value="' . $list->id . '">' . $list->name . '</option>';
}
?>
</select>
</div>
</div>
Expand All @@ -155,7 +155,7 @@
echo '<div class="container alert-success"><pre class="success-pre">';
print_r($returnContact);
echo '</pre></div>';
} ?>
}?>

</body>
</html>
10 changes: 5 additions & 5 deletions examples/createAndScheduleCampaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

<?php
// require the autoloaders
require_once '../src/Ctct/autoload.php';
require_once '../src/autoload.php';
require_once '../vendor/autoload.php';

use Ctct\ConstantContact;
use Ctct\Components\EmailMarketing\Campaign;
use Ctct\Components\EmailMarketing\Schedule;
use Ctct\Exceptions\CtctException;
use YousafSaqib\ConstantContact\ConstantContact;
use YousafSaqib\ConstantContact\Components\EmailMarketing\Campaign;
use YousafSaqib\ConstantContact\Components\EmailMarketing\Schedule;
use YousafSaqib\ConstantContact\Exceptions\CtctException;

// Enter your Constant Contact APIKEY and ACCESS_TOKEN
define("APIKEY", "ENTER YOUR API KEY");
Expand Down
6 changes: 3 additions & 3 deletions examples/getAccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

<?php
// require the autoloaders
require_once '../src/Ctct/autoload.php';
require_once '../src/autoload.php';
require_once '../vendor/autoload.php';

use Ctct\Auth\CtctOAuth2;
use Ctct\Exceptions\OAuth2Exception;
use YousafSaqib\ConstantContact\Auth\CtctOAuth2;
use YousafSaqib\ConstantContact\Exceptions\OAuth2Exception;

// Enter your Constant Contact APIKEY, CONSUMER_SECRET, and REDIRECT_URI
define("APIKEY", "ENTER YOUR API KEY");
Expand Down
4 changes: 2 additions & 2 deletions examples/importFromFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

<?php
// require the autoloaders
require_once '../src/Ctct/autoload.php';
require_once '../src/autoload.php';
require_once '../vendor/autoload.php';

use Ctct\ConstantContact;
use YousafSaqib\ConstantContact\ConstantContact;

// Enter your Constant Contact APIKEY and ACCESS_TOKEN
define("APIKEY", "ENTER YOUR API KEY");
Expand Down
4 changes: 2 additions & 2 deletions examples/uploadFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

<?php
// require the autoloaders
require_once '../src/Ctct/autoload.php';
require_once '../src/autoload.php';
require_once '../vendor/autoload.php';

use Ctct\ConstantContact;
use YousafSaqib\ConstantContact\ConstantContact;

// Enter your Constant Contact APIKEY and ACCESS_TOKEN
define("APIKEY", "ENTER YOUR API KEY");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Ctct\Auth;
namespace YousafSaqib\ConstantContact\Auth;

/**
* Interface containing the necessary functionality to manage an OAuth2 data store
Expand Down
8 changes: 4 additions & 4 deletions src/Ctct/Auth/CtctOAuth2.php → src/Auth/CtctOAuth2.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace Ctct\Auth;
namespace YousafSaqib\ConstantContact\Auth;

use Ctct\Exceptions\CtctException;
use Ctct\Exceptions\OAuth2Exception;
use Ctct\Util\Config;
use YousafSaqib\ConstantContact\Exceptions\CtctException;
use YousafSaqib\ConstantContact\Exceptions\OAuth2Exception;
use YousafSaqib\ConstantContact\Util\Config;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;

Expand Down
2 changes: 1 addition & 1 deletion src/Ctct/Auth/SessionDataStore.php → src/Auth/SessionDataStore.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Ctct\Auth;
namespace YousafSaqib\ConstantContact\Auth;

/**
* Example implementation of the CTCTDataStore interface that uses session for access token storage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Account;
namespace YousafSaqib\ConstantContact\Components\Account;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents account info associated with an access token in Constant Contact
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Account;
namespace YousafSaqib\ConstantContact\Components\Account;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents a single Verified Email Address in Constant Contact
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Activities;
namespace YousafSaqib\ConstantContact\Components\Activities;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents a single Activity in Constant Contact
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Activities;
namespace YousafSaqib\ConstantContact\Components\Activities;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents a single Activity Error in Constant Contact
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace Ctct\Components\Activities;
namespace YousafSaqib\ConstantContact\Components\Activities;

use Ctct\Components\Component;
use Ctct\Util\Config;
use Ctct\Exceptions\IllegalArgumentException;
use YousafSaqib\ConstantContact\Components\Component;
use YousafSaqib\ConstantContact\Util\Config;
use YousafSaqib\ConstantContact\Exceptions\IllegalArgumentException;

/**
* Represents an AddContacts Activity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace Ctct\Components\Activities;
namespace YousafSaqib\ConstantContact\Components\Activities;

use Ctct\Components\Component;
use Ctct\Components\Contacts\Address;
use Ctct\Components\Contacts\CustomField;
use YousafSaqib\ConstantContact\Components\Component;
use YousafSaqib\ConstantContact\Components\Contacts\Address;
use YousafSaqib\ConstantContact\Components\Contacts\CustomField;

/**
* Represents a single Activity in Constant Contact
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Activities;
namespace YousafSaqib\ConstantContact\Components\Activities;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents an Export Contacts Activity in Constant Contact
Expand Down
2 changes: 1 addition & 1 deletion src/Ctct/Components/Component.php → src/Components/Component.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Ctct\Components;
namespace YousafSaqib\ConstantContact\Components;

/**
* Super class for all components
Expand Down
4 changes: 2 additions & 2 deletions src/Ctct/Components/Contacts/Address.php → src/Components/Contacts/Address.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Contacts;
namespace YousafSaqib\ConstantContact\Components\Contacts;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents a single Address of a Contact
Expand Down
4 changes: 2 additions & 2 deletions src/Ctct/Components/Contacts/Contact.php → src/Components/Contacts/Contact.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Contacts;
namespace YousafSaqib\ConstantContact\Components\Contacts;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents a single Contact in Constant Contact
Expand Down
4 changes: 2 additions & 2 deletions src/Ctct/Components/Contacts/ContactList.php → src/Components/Contacts/ContactList.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Contacts;
namespace YousafSaqib\ConstantContact\Components\Contacts;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents a single Contact List
Expand Down
4 changes: 2 additions & 2 deletions src/Ctct/Components/Contacts/CustomField.php → src/Components/Contacts/CustomField.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Contacts;
namespace YousafSaqib\ConstantContact\Components\Contacts;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents a single Custom Field for a Contact
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Contacts;
namespace YousafSaqib\ConstantContact\Components\Contacts;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents a single EmailAddress of a Contact
Expand Down
4 changes: 2 additions & 2 deletions src/Ctct/Components/Contacts/Note.php → src/Components/Contacts/Note.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ctct\Components\Contacts;
namespace YousafSaqib\ConstantContact\Components\Contacts;

use Ctct\Components\Component;
use YousafSaqib\ConstantContact\Components\Component;

/**
* Represents a Contact Note
Expand Down
Loading