ph-7 / openai-sdk
An easy SDK for using OpenAI with PHP
v1.0.1
2022-03-24 09:49 UTC
Requires
- php: >=8.1.0
- guzzlehttp/guzzle: ^7.4
- psr/http-client: ^1.0
Requires (Dev)
- phake/phake: ^4.2
- phpunit/phpunit: ^9.5
README
👀 Contents
🔨 Requirements
- PHP 8.1 or newer 🎉
- Composer installed on your machine 📦
- An account on OpenAI for OpenAI's API keys.
💭 Examples
<?php require_once __DIR__ . '/vendor/autoload.php'; // Include Composer's autoload use PH7\OpenAi\Api\OpenAi as OpenAiApi; use PH7\OpenAi\Api\PrivateKey as OpenAiKey; use PH7\OpenAi\Client as AiClient; $apiKey = new OpenAiKey('YOUR_OPENAI_KEY_HERE'); $openAi = new AiClient( new OpenAiApi($apiKey) ); $openAi->search('Some keywords'); // To search $openAi->classifications('Some keywords'); // For OpenAI classifications
🎉 3rd party libraries
🧑🍳 Author
I'm Pierre-Henry Soria. A passionate, zen & dedicated software engineer 😊
You can keep in touch with me at: hi@ph7.me 📮
Me building it! 🔥
👉 Click here to watch on YouTube
📃 License
PHP OpenAI SDK is distributed under MIT license 🚀 Enjoy! ❤️
Note: This is not an official library published by OpenAI. I just want to help the community by providing a great library layer to be used with OpenAI.