datana-gmbh / zammad-api
API for Zammad
Installs: 153 159
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 0
Open Issues: 0
Requires
- php: >=8.0
- oskarstark/trimmed-non-empty-string: ^1.0
- psr/log: ^1.1 || ^2.0 || ^3.0
- symfony/http-client: ^5.1 || ^6.0 || ^7.0
- symfony/http-foundation: ^5.4 || ^6.0 || ^7.0
- symfony/mime: ^5.4 || ^6.0 || ^7.0
- thecodingmachine/safe: ^1.0 || ^2.0
- webmozart/assert: ^1.7
Requires (Dev)
- ergebnis/composer-normalize: ^2.2
- ergebnis/test-util: ^1.5
- friendsofphp/php-cs-fixer: ^2.19
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^0.12.14
- phpstan/phpstan-webmozart-assert: ^0.12.2
- phpunit/phpunit: ^9.0
- thecodingmachine/phpstan-safe-rule: ^1.0 || ^2.0
README
Usage
Installation
composer require datana-gmbh/zammad-api
Setup
use Datana\Zammad\Api\ZammadClient; $baseUri = 'https://...'; $token = '...'; $client = new ZammadClient($baseUri, $token); // you can now request any endpoint which needs authentication $client->request('GET', '/api/something', $options);
Tickets
In your code you should type-hint to Datana\Zammad\Api\TicketsApiInterface
Create a ticket
use Datana\Zammad\Api\Domain\Value\Ticket; use Datana\Zammad\Api\TicketsApi; use Datana\Zammad\Api\ZammadClient; $client = new ZammadClient(/* ... */); $ticketsApi = new TicketsApi($client); $ticket = new Ticket(/* ... */); $responseAsBool = $ticketsApi->create($ticket);
Update a ticket
use Datana\Zammad\Api\TicketsApi; use Datana\Zammad\Api\ZammadClient; $client = new ZammadClient(/* ... */); $ticketsApi = new TicketsApi($client); $responseAsBool = $ticketsApi->update(1, ['email' => 'foo@bar.de']);
Search for tickets
use Datana\Zammad\Api\TicketsApi; use Datana\Zammad\Api\ZammadClient; $client = new ZammadClient(/* ... */); $responseAsArray = $ticketsApi->search('foo');