承接 simonetoo/dify-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

simonetoo/dify-php

最新稳定版本:0.1.0

Composer 安装命令:

composer require simonetoo/dify-php

包简介

This is the PHP SDK for the Dify API.

README 文档

README

This is the PHP SDK for the Dify API, which allows you to easily integrate Dify into your PHP applications.

Requirements

  • PHP: ^7.2|^8.0
  • guzzlehttp/guzzle: ^7.8
  • ext-json: *

Usage

<?php

use \Simoneto\Dify\Dify;

$apiKey = 'your-api-key-here';

// Set the base uri.

Dify::setBaseUri('https://dify.xx.com');

// Create a http client.
$client = Dify::create();

// Create a http client with api key.
$client = Dify::createWithApiKey($apiKey);

// Create a chat app.
$chat = Dify::chat($apiKey);

// Create a completion app.
$completion = Dify::completion($apiKey);

// Get the dify app information.
$response = $chat->parameters();

// Get the app meta information.
$response = $chat->meta('user-id');

// Send a request to the chat application.
$response = $chat->send('user-id', 'Hello World!');

// Send a request to the chat application with enable streaming mode.
$streamResponse = $chat->stream('user-id','hello World!');

// Provide feedback for a message
$response = $chat->messageFeedback('user-id','message-id','like or dislike');

// Other methods:
// $chat->suggested();
// $chat->conversations();
// $chat->messages();
// ....
// 

Replace 'your-api-key-here' with your actual Dify API key.

License

This SDK is released under the MIT License.

统计信息

  • 总下载量: 429
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-25