sandwave-io/freshdesk-php

A PHP SDK for the Freshdesk REST API.

0.4.0 2023-03-13 19:05 UTC

This package is auto-updated.

Last update: 2024-11-09 11:39:14 UTC


README

Freshdesk API - PHP SDK

GitHub Workflow Status Packagist PHP Version Support Packagist PHP Version Support Packagist Downloads

Supported APIs

This SDK currently supports these APIs:

Are you missing functionality? Feel free to create an issue, or hit us up with a pull request.

How to use (REST API)

composer require sandwave-io/freshdesk-php
<?php

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);

How to contribute

Feel free to create a PR if you have any ideas for improvements. Or create an issue.

  • When adding code, make sure to add tests for it (phpunit).
  • Make sure the code adheres to our coding standards (use php-cs-fixer to check/fix).
  • Also make sure PHPStan does not find any bugs.
composer analyze # this will (dry)run php-cs-fixer, phpstan and phpunit

composer phpcs-fix # this will actually let php-cs-fixer run to fix

These tools will also run in GitHub actions on PR's and pushes on main.