Discover and explore top open-source AI tools and projects—updated daily.
Laravel package for OpenAI API interaction
Top 13.9% on SourcePulse
This package provides a PHP API client for interacting with the OpenAI API, specifically tailored for Laravel applications. It simplifies integrating powerful AI models like GPT into PHP-based web applications, benefiting developers seeking to leverage AI capabilities within their existing Laravel ecosystems.
How It Works
The package leverages the openai-php/client
for core API interactions and provides a Laravel-specific facade for seamless integration. Configuration is managed via environment variables or a dedicated configuration file, allowing easy setup of API keys, organization IDs, and base URLs. The design prioritizes ease of use and testability, offering a fake()
method for mocking API responses during development and testing.
Quick Start & Requirements
composer require openai-php/laravel
php artisan openai:install
config/openai.php
OPENAI_API_KEY
, OPENAI_ORGANIZATION
Highlighted Details
OpenAI
) for convenient API access.fake()
method for easy mocking of API responses in tests.Maintenance & Community
This is a community-maintained project with sponsorship opportunities for its core developers, Nuno Maduro and Sandro Gehri. For framework-agnostic usage, refer to the openai-php/client
repository.
Licensing & Compatibility
Licensed under the MIT license, permitting commercial use and integration with closed-source applications.
Limitations & Caveats
The package relies on the underlying openai-php/client
for feature set and model support. Specific limitations would be those inherent to the OpenAI API itself or the client library's implementation.
2 weeks ago
1 week