helgesverre/mistral
A Laravel wrapper for the Mistral AI API that lets you send chat completions, generate embeddings, and stream responses through a clean, expressive PHP interface. Includes configurable models, facades, and easy integration with Laravel apps.
composer require vendor/package (this release requires Saloon v4; ensure your app meets its PHP/Laravel constraints).php artisan vendor:publish --tag=package-config) and add required credentials to .env (API key, base URL, timeout).config/ file and README for available connectors/resources. Then skim the Saloon v4 upgrade guide for core HTTP client patterns.$response = $connector->send(new GetSomethingRequest());
$data = $response->json();
MockResponse::fixture('chat/create') — note the new slash separator (v3.0.0 breaking change). Store fixtures under tests/Fixtures/Saloon/.Connector for each API. Define resolveBaseUrl(), defaultHeaders(), defaultAuth(), and middleware() in the connector. Inject connectors via Laravel's container.ChatResource) that return configured requests for each endpoint. Inject the connector into the resource constructor.WithTokenAuth or a custom authenticator reading from config('package.api_key'). Keep secrets in .env.$response->failed() and use $response->throw() for automatic exceptions. Map Saloon exceptions to Laravel's handler for consistent API error responses.MockResponse::fixture('path/with/slashes') — rename old dot-based fixtures like chat.create → chat/create. For global fakes, use Saloon::fake([...]) in test setup.middleware() method. Use Laravel's logger or a custom middleware to log request/response bodies.Cache facade around the connector call, or implement a Saloon middleware that caches by request signature.Http client for non-Saloon APIs to avoid mixing HTTP layers.MockResponse::fixture('foo.bar') calls to MockResponse::fixture('foo/bar'). Update fixture file paths accordingly (tests/Fixtures/Saloon/foo/bar.json). Run the full test suite immediately after upgrading — fixture naming errors often surface only at runtime.send() return types, middleware interfaces). Adjust custom connectors, authenticators, and middleware as needed.$response->debug() or Saloon's built-in logger. For failing tests, inspect the fixture path and filename casing. Use php artisan test --filter=YourTest to isolate issues.config/package.php or directly in the connector. Clear Laravel's config cache after changing .env values (php artisan config:clear).resolveBaseUrl() or defaultHeaders() for multi-tenant setups. Register custom middleware globally via a service provider if the package doesn't expose a hook.config/app.php (Laravel 11+ auto-discovery usually handles it). If you see "class not found," run composer dump-autoload.MockResponse::fixture( and any dot-separated strings. Use grep -r "fixture('.*\..*'" to catch leftovers.chat/create, users/list) to match endpoint URLs and avoid future naming friction.How can I help you explore Laravel packages today?