1. Go to this page and download the library: Download hutsi/yii2-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/ */
use yii\helpers\StringHelper;
use hutsi\zendesk\Attachment;
use hutsi\zendesk\Search;
use hutsi\zendesk\Ticket;
use hutsi\zendesk\User;
use Yii;
use yii\web\UploadedFile;
$uploadedFile = new UploadedFile(['tempName' => 'YOUR_FILE_TEMPNAME', 'name' => 'YOUR_FILE_NAME]);
$zAttachment = new Attachment(['uploadedFile' => $uploadedFile]);
$token = $zAttachment->save();
$search = new Search(['query' => ['email' => '"[email protected]"']]);
if ($zUsers = $search->users()) {
$zUser = $zUsers[0];
} else {
$zUser = new User(['email' => '[email protected]');
$zUser->save();
}