PHP code example of sandwave-io / freshdesk-php

1. Go to this page and download the library: Download sandwave-io/freshdesk-php 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/ */

    

sandwave-io / freshdesk-php example snippets




use SandwaveIo\Freshdesk\SerializerFactory;
use SandwaveIo\Freshdesk\FreshdeskClient;
use SandwaveIo\Freshdesk\Client\RestClient;
use SandwaveIo\Freshdesk\RestClientFactory;

$factory = new RestClientFactory(
    'api-endpoint',
    'API key',
);

// The optional logger should implement \Psr\Log\LoggerInterface
$logger = new YourFavoritePSRLogger();

$serializer = SerializerFactory::create();
$restClient = new RestClient(
    $factory->create(),
    $serializer,
    $logger
);

$freshdeskClient = new FreshdeskClient($restClient);
$freshdeskClient->getTicketClient()->get(123);