adrii / zendesk-api
Lightweight library that allows you to create, edit, delete and upload files to Zendesk. In a clean and standard way.
Installs: 2 049
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- adrii/curl-helper: ^1.6
README
By Adrii
Lightweight library that allows you to create, edit, delete and upload files to Zendesk Suppot. In a clean and standard way.
Installation
Use Composer to install the library.
composer require adrii/zendesk-api
Composer
use Adrii\ZendeskAPI;
Manual
require_once ROOT . 'ZendeskAPI.php';
Usage
$data = array( "username" => "1234qwer", "type" => "problem", "tags" => "ios,test", "subject" => "Test", "body" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tempor semper enim. Nam non semper ligula. Vestibulum sapien sapien, hendrerit pharetra elementum a, faucibus id nisl. Aenean ornare rhoncus ligula, eget efficitur augue suscipit vehicula. Fusce faucibus odio magna, sit amet aliquet ipsum sodales a.", "first_name" => "Adrii", "last_name" => "🍍", "email" => "adrian.villamayor@gmail.com", ); for ($i = 0; $i < count($files); $i++) { $zendesk->upload($files[$i]['name'], $files[$i]['tmp_name']); } $comment = array( array( 'type' => $data['type'], 'tags' => explode(",", $data['tags']), 'subject' => $data['subject'], 'comment' => array( 'body' => $data['body'], 'public' => false, "uploads" => $zendesk->getUpload() ), 'requester' => array( 'locale_id' => '1', 'name' => $data['first_name'] . " " . $data['last_name'], 'email' => $data['email'], ), 'priority' => 'normal', ) ); $subdomain = "{subdomain}"; $user = "{user}"; $token = "{token}"; $zend = new ZendeskApi($subdomain, $user, $token); $zend->create($comment);
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Thanks for your help! 🎉