1. Go to this page and download the library: Download guj-dvs/data-push-sdk-php 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/ */
guj-dvs / data-push-sdk-php example snippets
Guj\DataPush\Model\Child;
use \Guj\DataPush\Model\Order;
use \Guj\DataPush\Model\PushData;
use \Guj\DataPush\Model\UserData;
use \Guj\DataPush\Provider\GujDataPushProvider;
/**
* Configure
*/
GujDataPushProvider::init(
array(
// 'aws_sqs_region' => 'eu-west-1', // default value
'aws_sqs_queue_name' => '[[ QUEUE_NAME ]]',
'aws_sqs_key' => '[[ AWS_KEY ]]',
'aws_sqs_secret' => '[[ AWS_SECRET ]]'
)
);
/**
* Create PushData and set base data
*/
$data = new PushData();
$data->setProducer('TestProducer'); // REQUIRED
$data->setClient('TestClient'); // REQUIRED
$data->setType('TestType'); // REQUIRED
$data->setCreatedAt( time() );
/**
* Set UserData
*/
$userData = new UserData();
$userData->setSsoId(123456789);
$userData->setDateOfBirth('01.01.1950');
$userData->setName('John');
$userData->setLastName('Doe');
$userData->setEmail('[email protected]');
$userData->setCity('SampleCity');
$userData->setPostcode(12345);
$userData->setStreet('Street');
$userData->setStreetNo('1');
$data->setUserData($userData);
/**
* Add Child to collection
*/
$child = new Child();
$child->setName('Jane');
$child->setLastName('Doe');
$child->setGender('f');
$child->setDateOfBirth('01.01.1990');
$data->addChild($child);
/*
* Add other data...
* See full List of possible data in README.md
*/
/**
* Encrypt and push data
*/
$result = GujDataPushProvider::encryptAndPushObject($data);
var_dump($result);
Guj\DataPush\Provider\GujDataPushProvider;
/**
* Create array for pushdata request
*/
$data = array(
'version' => '1.0.0',
'producer' => 'TestProducer', // REQUIRED
'client' => 'TestClient', // REQUIRED
'type' => 'data', // REQUIRED
'createdAt' => '2016-03-22T08:04:22Z', // REQUIRED
'userData' =>
array(
'ssoId' => '123456789',
'customerNo' => '',
'userName' => 'johnDoe',
'name' => 'John',
'lastName' => 'Doe',
'gender' => 'm',
'dateOfBirth' => '2001-01-01T00:11:22Z',
'email' => '[email protected]',
'phone' => '123456789',
'mobile' => '132456789',
'company' => 'Company Ltd.',
'street' => 'Street',
'streetNo' => '1',
'careOf' => 'at Ms. Smith',
'postcode' => '12345',
'city' => 'TestCity',
'country' => 'SampleCountry',
),
'children' =>
array(
0 =>
array(
'name' => 'Jane',
'lastname' => 'Doe',
'gender' => 'f',
'dateOfBirth' => '2001-01-01T00:11:22Z',
),
),
'newsletter' =>
array(...), // See example for full details
'orders' =>
array(...), // See example for full details
'optIn' =>
array(...), // See example for full details
'terms' =>
array(...), // See example for full details
'campaigns' =>
array(...), // See example for full details
'appUsage' => '',
'milestoneDelivery' => ''
);
/**
* Encrypt and push data
*/
$result = GujDataPushProvider::encryptAndPushArray($data);
var_dump($result);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.