Download the PHP package leandroferreirama/openai-php without Composer

On this page you can find all versions of the php package leandroferreirama/openai-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package openai-php

OpenAI PHP Client

This is a simple PHP client for interacting with the OpenAI API, allowing you to create assistants, manage threads, and send messages.

Installation

You can install the package via Composer. Run the following command in your terminal:

Environment Configuration

Before you start using the package, create a copy of the .env.example file and rename it to .env. Then, paste your OpenAI API key into the .env file.

Usage

Creating an Assistant

You can create an assistant using the following code:

Creating a Thread

To create a thread, use the following:

Sending Messages

Send messages to the assistant like this:

Getting Responses

The assistant's response will be returned as a string:

Example

You can find an example of usage in the example/index.php file.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Cliente PHP para OpenAI

Este é um cliente PHP simples para interagir com a API da OpenAI, permitindo que você crie assistentes, gerencie threads e envie mensagens.

Instalação

Você pode instalar o pacote via Composer. Execute o seguinte comando no seu terminal:

Configuração do Ambiente

Antes de começar a usar o pacote, crie uma cópia do arquivo .env.example e renomeie para .env. Em seguida, cole sua chave da API da OpenAI no arquivo .env.

Uso

Criando um Assistente

Você pode criar um assistente usando o seguinte código:

Criando uma Thread

Para criar uma thread, use o seguinte:

Enviando Mensagens

Envie mensagens ao assistente assim:

Obtendo Respostas

A resposta do assistente será retornada como uma string:

Exemplo

Você pode encontrar um exemplo de uso no arquivo example/index.php.

Licença

Este projeto é licenciado sob a Licença MIT. Veja o arquivo LICENSE para detalhes.


All versions of openai-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
vlucas/phpdotenv Version ^5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package leandroferreirama/openai-php contains the following files

Loading the files please wait ....