hasfoug/freshdesk-laravel

Laravel package for the Freshdesk API (v2). Added laravel 8 support

Installs: 3 058

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 44

Type:laravel-package

1.0 2022-02-22 08:21 UTC

This package is auto-updated.

Last update: 2024-05-22 13:29:26 UTC


README

Build Status Scrutinizer Code Quality SensioLabsInsight Packagist

This is a service provider for interacting with the Freshdesk API v2 via the freshdesk-php-sdk in Laravel and Lumen applications.

Installation

Run:

composer require hasfoug/freshdesk-laravel

Then add the Freshdesk facade alias in the aliases key in your config/app.php:

    'aliases' => array(
        // ...
        'Freshdesk' => Mpclarkson\Laravel\Freshdesk\Freshdesk::class,
    )

Configuration

Set these env variables:

FRESHDESK_API_KEY=
FRESHDESK_DOMAIN=

If you need to customize the config - you can publish it by running following command:

php artisan vendor:publish --provider="Mpclarkson\Laravel\Freshdesk\FreshdeskServiceProvider"

Accessing the Freshdesk API

In a controller you can access Freshdesk resource as follows:

//Contacts
$contacts = Freshdesk::contacts()->update($contactId, $data);

//Agents
$me = Freshdesk::agents()->current();

//Companies
$company = Freshdesk::companies()->create($data);

//Groups
$deleted = Freshdesk::groups()->delete($groupId);

//Tickets
$ticket = Freshdesk::tickets()->view($filters);

//Time Entries
$time = Freshdesk::timeEntries()->all($ticket['id']);

//Conversations
$ticket = Freshdesk::conversations()->note($ticketId, $data);

//Categories
$newCategory = Freshdesk::categories()->create($data);

//Forums
$forum = Freshdesk::forums()->create($categoryId, $data);

//Topics
$topics =Freshdesk::topics()->monitor($topicId, $userId);

//Comments
$comment = Freshdesk::comments()->create($forumId);

//Email Configs
$configs = Freshdesk::emailConfigs()->all();

//Products
$product = Freshdesk::products()->view($productId);

//Business Hours
$hours = Freshdesk::businessHours()->all();

//SLA Policy
$policies = Freshdesk::slaPolicies()->all();

Filtering

All GET requests accept an optional array $query parameter to filter results. For example:

//Page 2 with 50 results per page
$page2 = Freshdesk::forums()->all(['page' => 2, 'per_page' => 50]);

//Tickets for a specific customer
$tickets = Freshdesk::tickets()->view(['company_id' => $companyId]);

Please read the Freshdesk documentation for further information on filtering GET requests.

Contributing

This is a work in progress and PRs are welcome. Please read the contributing guide.

Author

The library was written and maintained by Matthew Clarkson from Hilenium.

References