mohamed-fathy/freshdesk-php-sdk
PHP 5.5+ SDK for Freshdesk API v2. Create an Api client with your API key and domain, then manage tickets, contacts, agents, companies, groups, and more with simple CRUD methods returning plain arrays.
Pros:
freshdesk-laravel), enabling seamless integration with Laravel’s dependency injection (DI) container. This aligns with Laravel’s architectural patterns (e.g., service containers, facades, and service providers) and reduces boilerplate for API initialization.tickets, contacts, companies), which maps cleanly to Laravel’s Eloquent ORM conventions and RESTful API design principles. This facilitates intuitive method chaining (e.g., $api->tickets->create()).composer.json workflows.UnsupportedContentTypeException) allow for graceful error handling, which can be extended with Laravel’s exception handlers or middleware.Cons:
create, update, delete, view) align well with Laravel’s CRUD patterns. For example:
makeAgent() for role-based access).Illuminate\Http\Testing\XmlHttpRequest or Laravel Websockets).create_function, json_encode without JSON_THROW_ON_ERROR).mixed return types may conflict with Laravel’s strict typing).SimplePaginator).throttle middleware would need customization.Illuminate\Cache\RateLimiter).Spatie\Retry package).stubs or a custom wrapper. Key areas to audit:
Http client (Illuminate\Support\Facades\Http) for direct API integration with better control.Http tests or PestPHP).freshdesk-laravel package provides a service provider to bind the SDK to Laravel’s container. Register it in config/app.php:
'providers' => [
Freshdesk\Laravel\FreshdeskServiceProvider::class,
],
$freshdesk = app(Freshdesk\Api::class);
.env variables for FRESHDESK_API_KEY and FRESHDESK_DOMAIN.Ticket, Contact).ticket.created).freshdesk:process-ticket) using Laravel’s queue system.contacts) using Laravel’s cache drivers.Http tests or Mockery to stub the SDK in unit tests.$this->mock(Freshdesk\Api::class)->shouldReceive('tickets->create')->once();
phpstan or psalm).tickets->create, contacts->all) in a staging environment.namespace App\Services;
use Freshdesk\Api;
class FreshdeskService {
public function __construct(protected Api $api) {}
public function createTicket(array $data) {
return $this->api->tickets->create($data);
}
}
$this->app->bind(FreshdeskService::class, function ($app) {
return new FreshdeskService(new Api(
config('services.freshdesk.key'),
config('services.freshdesk.domain')
));
});
Http client:
public function uploadAttachment($ticketId, $filePath) {
return Http::attach('file', $filePath)
->post("https://{domain}/api/v2/tickets/{ticketId}/attachments", [
'api_key' => config('services.freshdesk.key'),
]);
}
route:webhook or a package like spatie/laravel-webhook-client.| Component | Compatibility | Notes |
|---|---|---|
| Laravel 10+ | ⚠️ Partial | PHP 8.1+ may break SDK |
How can I help you explore Laravel packages today?