javaabu / dhivehigpt-sdk
PHP / Laravel SDK to interact with the DhivehiGPT API
Requires
- php: ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- illuminate/support: ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0
- orchestra/testbench: ^7.0 || ^8.0 || ^9.16 || ^10.0 || ^11.0
- phpunit/phpunit: ^9.5 || ^10.5 || ^11.5.3 || ^12.5.8 || ^13.0.3
Suggests
- illuminate/support: Required to use the DhivehiGpt Laravel service provider and facade (^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0).
This package is auto-updated.
Last update: 2026-08-21 18:50:22 UTC
README
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.
Installation
You can install the package via composer:
composer require javaabu/dhivehigpt-sdk
Getting an API key
You 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.
Basic usage
Plain PHP
use Javaabu\DhivehiGpt\DhivehiGpt; $dhivehigpt = new DhivehiGpt('YOUR_API_KEY'); $voices = $dhivehigpt->voices()->list(); $audio = $dhivehigpt->tts()->generate('ދިވެހިޖީޕީޓީއަށް މަރުޙަބާ', 'hajja');
Laravel
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.
Documentation
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.
Testing
You can run the tests with
./vendor/bin/phpunit
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email info@javaabu.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.