aisdk / core
Framework-agnostic PHP AI SDK.
Fund package maintenance!
v0.11.0
2026-10-31 02:58 UTC
Requires
- php: ^8.3
- guzzlehttp/guzzle: ^7.15.2 || ^8.3.0
- php-http/discovery: ^1.19
- psr/container: ^2.0
- psr/http-client: ^1.0
- psr/http-factory: ^1.1
- psr/http-message: ^2.0
- psr/log: ^3.0
Requires (Dev)
- laravel/pint: ^1.18
- nyholm/psr7: ^1.8
- pestphp/pest: ^3.0 || ^4.0
- phpstan/phpstan: ^2.0
- rector/rector: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A framework-agnostic PHP SDK for working with AI providers. Generate text, images, audio, video, embeddings, and structured decisions; build agents with tools, approvals, and conversation storage.
Installation
composer require aisdk/core aisdk/openai
Requires PHP 8.3 or later. Set OPENAI_API_KEY in your environment. Each provider is a separate Composer package; this example installs OpenAI.
Usage
use AiSdk\Generate; use AiSdk\OpenAI; $result = Generate::text('Explain closures in PHP in one sentence.') ->model(OpenAI::model('gpt-6.1-sol')) ->run(); echo $result->text;
Use ->stream() for streaming responses. The SDK also provides instance-based runtimes for dependency injection and long-running workers.
Documentation
Read the documentation for configuration, supported features, and more examples.
License
The MIT License (MIT). See LICENSE for details.