Download the PHP package imiphp/openai-chatgpt without Composer

On this page you can find all versions of the php package imiphp/openai-chatgpt. 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-chatgpt

说明

这是一个在 imi 框架接入 OpenAI ChatGPT 的 Demo 项目。

OpenAI 的接口使用了 html5 新加入的 event-stream 技术,imi 编写的接口同样采用了该技术,可以实现实时返回 AI 回复的内容。

建议使用 Swoole 最新版本!

imi 框架:https://www.imiphp.com

imi 文档:https://doc.imiphp.com

OpenAI:https://platform.openai.com/

如何注册请自行搜索解决。

安装

创建项目:composer create-project imiphp/openai-chatgpt

配置

复制 .env.tpl.env

修改 .env 配置即可。

运行

vendor/bin/imi-swoole swoole/start

访问测试

http://127.0.0.1:8080/

控制器:Module/Test/ApiController/IndexController.php

页面模版:Module/Test/template/index/index.html

生产环境

关闭热更新:config/beans.phphotUpdate.status 设为 false

代码质量

格式化代码

内置 php-cs-fixer,统一代码风格。

配置文件 .php-cs-fixer.php,可根据自己实际需要进行配置,文档:https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/config.rst

格式化项目: ./vendor/bin/php-cs-fixer fix

格式化指定文件: ./vendor/bin/php-cs-fixer fix test.php

代码静态分析

内置 phpstan,可规范代码,排查出一些隐藏问题。

配置文件 phpstan.neon,可根据自己实际需要进行配置,文档:https://phpstan.org/config-reference

分析项目: ./vendor/bin/phpstan

分析指定文件: ./vendor/bin/phpstan test.php

测试用例

内置 phpunit,可以实现自动化测试。

文档:https://phpunit.readthedocs.io/en/9.5/

测试用例 demo:tests/Module/Test/TestServiceTest.php

运行测试用例:composer test


All versions of openai-chatgpt with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
imiphp/imi Version ~2.1.0
imiphp/imi-swoole Version ~2.1.0
orhanerday/open-ai Version ^4.7
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 imiphp/openai-chatgpt contains the following files

Loading the files please wait ....