The CoinQuant PHP SDK is designed to work seamlessly with Laravel 10, 11, 12, and 13. It leverages Laravel's package auto-discovery to register its Service Provider and Facade automatically, requiring minimal configuration on your end [1]. ## Configuration After installing the package via Composer, you need to set your API token in your Laravel `.env` file. ```env COINQUANT_TOKEN=your_access_token_here ``` ### Publishing the Configuration File (Optional) By default, the SDK connects to `https://api.coinquant.ai`. If you need to override the base URL or explicitly manage the configuration, you can publish the package's configuration file: ```bash php artisan vendor:publish --tag=coinquant-config ``` This will create a `config/coinquant.php` file in your application: ```php env('COINQUANT_TOKEN', ''), 'base_url' => env('COINQUANT_BASE_URL', 'https://api.coinquant.ai'), ]; ``` ## Using the Facade The easiest way to interact with the API in Laravel is by using the `CoinQuant` facade. The facade provides static access to all methods available on the `CoinQuantClient`. ```php json([ 'available' => $credits['available_credits_total'] ]); } public function generateStrategy(): JsonResponse { $result = CoinQuant::prompt('Research BTC volatility this week.'); return response()->json([ 'type' => $result->type, 'content' => $result->text ]); } } ``` ## Dependency Injection The `CoinQuantClient` is bound to Laravel's service container as a singleton. This means you can type-hint it in your controllers, jobs, console commands, or any other class resolved by the container, and Laravel will automatically inject the configured instance [1]. ```php createBacktestAndWait($this->strategyVersionId); // Process the outcome... } } ``` ## Manual Registration (Legacy/Disabled Auto-discovery) If you are using a Laravel version without package auto-discovery, or if you have disabled it for this package, you must register the service provider and facade manually in your `config/app.php` file: ```php 'providers' => [ // ... CoinQuant\Laravel\CoinQuantServiceProvider::class, ], 'aliases' => [ // ... 'CoinQuant' => CoinQuant\Laravel\Facades\CoinQuant::class, ], ``` --- ### References [1] [CoinQuant PHP SDK README](https://github.com/tigusigalpa/coinquant-php/blob/main/README.md)