1. Go to this page and download the library: Download codebar-ag/laravel-zendesk 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/ */
codebar-ag / laravel-zendesk example snippets
use CodebarAg\Zendesk\ZendeskConnector;
...
$connector = new ZendeskConnector();
use CodebarAg\Zendesk\Requests\CreateSingleTicketRequest;
use CodebarAg\Zendesk\DTOs\SingleTicketDTO;
use CodebarAg\Zendesk\DTOs\CommentDTO;
use CodebarAg\Zendesk\Enums\TicketPriority;
...
$ticketResponse = $connector->send(
new CreateSingleTicketRequest(
SingleTicketDTO::fromArray([
'comment' => CommentDTO::fromArray([
'body' => 'The smoke is very colorful.',
]),
'priority' => TicketPriority::URGENT,
"subject" => "My printer is on fire!",
"custom_fields" => [
[
"id" => 12345678910111,
"value" => "Your custom field value"
],
[
"id" => 12345678910112,
"value" => "Your custom field value 2"
],
],
])
)
);
$ticket = $ticketResponse->dto();
use CodebarAg\Zendesk\Requests\AllTicketsRequest;
...
$listTicketResponse = $connector->send(new AllTicketsRequest());
$listTicketResponse->dto();
use CodebarAg\Zendesk\Requests\CountTicketsRequest;
...
$countTicketResponse = $connector->send(new CountTicketsRequest());
$countTicketResponse->dto();