A lightweight PHP / Laravel SDK for the DhivehiGPT API, covering voices, text-to-speech, subscription balance, and tasks. It has no framework dependency, so it works in plain PHP applications as well as any Laravel application from version 9 through 13. Its only dependency is Guzzle, the standard PHP HTTP client — already installed in most Laravel and modern PHP projects.
You can install the package via composer:
composer require javaabu/dhivehigpt-sdkYou need a DhivehiGPT team account with an active subscription to generate API keys, and only team owners and admins can generate them. Generate one from the API Keys page in your DhivehiGPT team account.
use Javaabu\DhivehiGpt\DhivehiGpt;
$dhivehigpt = new DhivehiGpt('YOUR_API_KEY');
$voices = $dhivehigpt->voices()->list();
$audio = $dhivehigpt->tts()->generate('ދިވެހިޖީޕީޓީއަށް މަރުޙަބާ', 'hajja');The package's configuration is read from the dhivehigpt key in Laravel's built-in config/services.php file — there is no separate config file to publish. Add the following:
'dhivehigpt' => [
'api_key' => env('DHIVEHIGPT_API_KEY'),
'base_url' => env('DHIVEHIGPT_BASE_URL'), // optional
'api_version' => env('DHIVEHIGPT_API_VERSION'), // optional
'guzzle' => [], // optional, additional Guzzle client options
],Then set your API key in .env:
DHIVEHIGPT_API_KEY=sk-dvgpt-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxx
The service provider and the DhivehiGpt facade are auto-discovered. Use the facade, or inject Javaabu\DhivehiGpt\DhivehiGpt:
use Javaabu\DhivehiGpt\Facades\DhivehiGpt;
$voices = DhivehiGpt::voices()->list();
$audio = DhivehiGpt::tts()->generate('ދިވެހިޖީޕީޓީއަށް މަރުޙަބާ', 'hajja');See Installation & Setup for the full details, including how to customize the underlying Guzzle client.
You'll find the full documentation on https://docs.javaabu.com/docs/dhivehigpt-sdk-php.
Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving this package? Feel free to create an issue on GitHub, we'll try to address it as soon as possible.
If you've found a bug regarding security please mail info@javaabu.com instead of using the issue tracker.
You can run the tests with
./vendor/bin/phpunitPlease see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email info@javaabu.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.