PHP code example of g4 / customer-support
1. Go to this page and download the library: Download g4/customer-support 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/ */
g4 / customer-support example snippets
php
$adapter = 'Zendesk';
$options = (new \G4\Gateway\Options())
->addHeader('Authorization', 'Basic *********************************')
->addHeader('Content-Type', 'application/json');
$gateway = new \G4\Gateway\Http('url', $options);
$data = new Dictionary([
'name' => 'test'
'email' => '[email protected]'
'subject' => 'test'
'comment' => 'test'
]);
$customerSupport = new (G4\CustomerSupport\CustomerSupportFactory)
$customerSupport
->setEmail(new Email($data->get('email')))
->setName(new StringLiteral($data->get('name')))
->setSubject(new StringLiteral($data->get('subject')))
->setComment(new StringLiteral($data->get('comment')))
->setGateway($gateway)
->setAdapter($adapter);
->createInstance()