openai-php / client

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

Comile error #197

Closed Ronaldo-F-dev closed 1 year ago

Ronaldo-F-dev commented 1 year ago

Who can help me ? I have this message when i try to use this package. Compile Error: Cannot declare class OpenAI, because the name is already in use

pb30 commented 1 year ago

Do you have any other OpenAI packages installed? Can you share your composer.json? Did you create your own OpenAI class?

iBotPeaches commented 1 year ago

This class doesn't have a namespace so OpenAI is reserved once its installed - https://github.com/openai-php/client/blob/main/src/OpenAI.php

So yeah either this package should namespace that to OpenAI/OpenAI or you have to find what else is using that class name and remove it.

gehrisandro commented 1 year ago

@Ronaldo-F-dev @iBotPeaches

It is intended to have no namespace here.

Therefore you have to look where your conflicting class comes from.