Skip to content
dhivehigpt-sdk-php / v1

Laravel Usage

Last updated:

On this page

Once your API key is set in config/services.php (see Installation & Setup), you can resolve the client three ways.

Using the facade

use Javaabu\DhivehiGpt\Facades\DhivehiGpt;

$voices = DhivehiGpt::voices()->list();

Using dependency injection

use Javaabu\DhivehiGpt\DhivehiGpt;

class TtsController
{
    public function store(DhivehiGpt $dhivehigpt)
    {
        return $dhivehigpt->tts()->generate('ދިވެހިޖީޕީޓީއަށް މަރުޙަބާ', 'hajja');
    }
}

Resolving from the container

$dhivehigpt = app('dhivehigpt');
// or
$dhivehigpt = app(\Javaabu\DhivehiGpt\DhivehiGpt::class);

In all three cases you get back the same singleton instance, configured from config/services.php.

Documentation
All packages

javaabu/dhivehigpt-sdk-php

Source on GitHub