GithubHelp home page GithubHelp logo

wherestheguac / exacttarget-php-soap-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hglattergotz/exacttarget-php-soap-api

0.0 1.0 0.0 228 KB

A php library for accessing the ExactTarget SOAP API

License: MIT License

PHP 100.00%

exacttarget-php-soap-api's Introduction

ExactTarget

PHP wrapper for ExactTarget SOAP API

This is a php library for accessing a subset of ExactTarget's SOAP API. It provides synchronous CRUD operations on Data Extensions and Subscriber Lists by exposing a Doctrine-like API (Record, Table, Collection). The ExactTarget API documentation can be found here.




To interact with the Soap API the library provides the basic classes that represent a Record, Table and Collection.

The names are pretty self explanatory and if you are familiar with Doctrine this will be very familiar.

  • The record class allows for manipulation of a single record (CRUD).
  • The table class exposes queries on the entire table and returns one or more records in form of a collection.
  • A collection is a container class that holds a variable number of record objects and provides various methods to iterate over them or to create, update or delete them with a single operation.

To interact with a Data Extension with the following schema you simply extend the AbstractETDataExtensionObject and AbstractETDataExtension classes.

Schema

<?php
id (primary key)
firstname
lastname
email

Record

<?php
class PersonDataExtensionObject extends AbstractETDataExtensionObject
{
    protected function configure()
    {
        $this->customerKey = 'my customer key for this DE';
        $this->schema = array(
            'id' => array(
                'is_primary'  => true,
                'is_required' => true,
                'type'        => self::TYPE_NUMBER),
            'firstname' => array(
                'is_primary'  => false,
                'is_required' => false,
                'type'        => self::TYPE_TEXT),
            'lastname' => array(
                'is_primary'  => false,
                'is_required' => false,
                'type'        => self::TYPE_NUMBER),
            'email' => array(
                'is_primary'  => false,
                'is_required' => true,
                'type'        => self::TYPE_NUMBER)
        );
    }
}

Table (Data Extension)

<?php
class PersonDataExtension extends AbstractETDataExtension
{}

Important: The two related classes must have the same name, but the Record class has Object appended to it.

Fetch a record from the data extension and modify it.
<?php
ETCore::initialize('myusername', 'mypassword');

$personDE = new PersonDataExtension();
$allPeople = $personDE->findAll(ETCore::HYDRATE_RECORD);
$person = $allPeople->getFirst();
$person->setfirstname('Joe');
$person->save();
Create a new record
<?php
ETCore::initialize('myusername', 'mypassword');

$personData = array(
    'id' => 123,
    'firstname' => 'Joe',
    'lastname' => 'Smith',
    'email' => '[email protected]'
);
$person = new PersonDataExtensionObject();
$person->fromArray($personData);
$person->save();

Please refer to the LICENSE file in this repository.


ExactTarget is a registered trademark of ExactTarget, Inc.

exacttarget-php-soap-api's People

Contributors

hglattergotz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.