procergs / usd-php
PHP lib to interact with our internal issue/helpdesk tool.
dev-master
2018-02-01 19:17 UTC
Requires
- php: ^7.0
- giggsey/libphonenumber-for-php: ^8.8
- guzzlehttp/guzzle: ~6.0
- jms/serializer: ^1.10
Requires (Dev)
- phpunit/phpunit: ^6
This package is auto-updated.
Last update: 2024-12-12 04:24:41 UTC
README
PHP lib to interact with our internal issue/helpdesk tool.
Usage
Add it to your dependencies:
composer require procergs/usd-php
Code example:
<?php require_once 'vendor/autoload.php'; use GuzzleHttp\Client; use PROCERGS\USD\UsdService; use PROCERGS\USD\Model\Issue; use PROCERGS\USD\Model\IssueBuilder; use PROCERGS\USD\Model\EndUser; $systemCode = 999999; // Your system's user code $org = "YOUR SYSTEM'S ORG"; $pass = "your system's user password"; $config = [ 'defaultPhoneCountry' => 'BR', // or another default country code 'newIssueEndpoint' => 'https://endpoit.used.for.issue.creation', 'getIssueEndpoint' => 'https://endpoit.used.for.getting.issues', ]; $http = new Client([ 'headers' => [ 'matricula' => $systemCode, 'organizacao' => $org, 'senha' => $pass, ], ]); $usd = new UsdService($http, $config); $endUser = new EndUser('John Doe', 'john@doe.net', 'john.doe'); $builder = (new IssueBuilder()) ->setTitle('Server unresponsive') ->setDescription("I'm unable to ping the TEST server. There is no route to it.") ->setArea('Ops') ->setOrganization('My Company') ->setConfigurationItem('SERVER-7356') ->setGroup('Ops.HelpDesk') ->setEndUser($endUser) ->setSymptom('Server unresponsive'); $issue = $usd->createIssue(new Issue($builder)); // the issue is now persisted on the backend, so it'll have and ID $issueId = $issue->getId(); // let's fetch it again to test the GET operation $fetched = $usd->getIssue($issueId);