openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.56k stars 466 forks source link

Fatal error: Cannot declare class OpenAI, because the name is already in use in E:\Xampp_8.2\htdocs\ia\vendor\openai-php\client\src\OpenAI.php on line 8 [Bug]: #378

Closed neutronixx closed 1 month ago

neutronixx commented 2 months ago

Description

Installing and testing the repo I get this error: Fatal error: Cannot declare class OpenAI, because the name is already in use in E:\Xampp_8.2\htdocs\ia\vendor\openai-php\client\src\OpenAI.php on line 8

Steps To Reproduce

using the example code on home page i get this error

OpenAI PHP Client Version

v0.8.5

PHP Version

8.2

Notes

No response

NilsCJ commented 2 months ago

I have the same issue, and I couldn't find the answer yet.

graphem commented 1 month ago

My issue was that I used use OpenAI\OpenAI;

Fixed with use OpenAI;