Discover and explore top open-source AI tools and projects—updated daily.
openai-phpLaravel package for OpenAI API interaction
Top 13.4% 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/laravelphp artisan openai:installconfig/openai.phpOPENAI_API_KEY, OPENAI_ORGANIZATIONHighlighted 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.
3 days ago
1 week
r2d4
njerschow