vectorifyai/vectorify-php
Composer 安装命令:
composer require vectorifyai/vectorify-php
包简介
Vectorify package for PHP. The fastest way to ask AI about your data.
README 文档
README
Vectorify is the end-to-end AI connector for PHP, letting you query and explore your data in natural language in seconds.
To interact with your data, you have four primary methods to choose from:
- Use the Chats page within our platform (fastest)
- Embed the Chatbot into your PHP app (turn data querying into a product feature)
- Add the MCP server to ChatGPT, Claude, etc. (use your data anywhere you work)
- Call the REST API endpoints (build custom integrations and workflows)
Unlike text-to-SQL tools that expose your entire database and take 30+ seconds per query, Vectorify uses proven RAG technology to deliver accurate answers in <4 seconds while keeping your database secure. Head to our blog to learn more about Vectorify.
This package provides a simple and elegant way to interact with the Vectorify API. Ask AI about your data with ease.
Requirements
- PHP 8.2 or higher
Installation
Install the package via Composer:
composer require vectorifyai/vectorify-php
Quick Start
use Vectorify\Vectorify; use Vectorify\Objects\CollectionObject; use Vectorify\Objects\ItemObject; use Vectorify\Objects\UpsertObject; use Vectorify\Objects\QueryObject; // Initialize the client $vectorify = new Vectorify('your-api-key'); // Create a collection $collection = new CollectionObject( slug: 'invoices', metadata: [ 'customer_name' => ['type' => 'string'], 'status' => [ 'type' => 'enum', 'options' => ['draft', 'sent', 'paid'], ] ], ); // Create items $items = [ new ItemObject( id: '123', data: [ 'customer_name' => 'John Doe', 'status' => 'draft', 'amount' => '100', 'currency' => 'USD', 'due_date' => '2023-10-01' ], metadata: [ 'customer_name' => 'John Doe', 'status' => 'draft' ], tenant: 987, url: 'https://example.com/invoice/123', ), ]; // Upsert data $upsertObject = new UpsertObject($collection, $items); $success = $vectorify->upserts->create($upsertObject); if ($success) { echo "Data upserted successfully!\n"; } // Query data $queryObject = new QueryObject( text: 'how many invoices are in draft status?', collections: ['invoices'], tenant: 987, identifier: [ 'id' => '123', 'name' => 'John Doe', 'email' => 'john@example.com', ] ); $result = $vectorify->query->send($queryObject); if ($result !== false) { print_r($result); }
Features
- Rate Limiting: Automatic rate limit handling with exponential backoff
- Retry Logic: Built-in retry mechanism for failed requests
- Type Safety: Fully typed objects for better development experience
- Error Handling: Comprehensive error handling and logging
- PSR-7 Compatible: Uses PSR-7 HTTP message interfaces
API Methods
Upsert
Create or update items in your Vectorify collection:
$upsertObject = new UpsertObject($collection, $items); $success = $vectorify->upserts->create($upsertObject);
Query
Ask questions about your data:
$queryObject = new QueryObject('your question here'); $result = $vectorify->query->send($queryObject);
Configuration
Timeout
You can configure the request timeout when initializing the client:
$vectorify = new Vectorify('your-api-key', 60); // 60 seconds timeout
Debug Logging
Enable debug logging by defining a constant:
define('VECTORIFY_DEBUG', true);
Error Handling
The SDK includes comprehensive error handling:
- Rate Limiting: Automatically handles 429 responses with appropriate delays
- Server Errors: Retries server errors (5xx) with exponential backoff
- Client Errors: Returns
nullorfalsefor client errors (4xx) - Network Errors: Retries network-related errors
Changelog
Please see Releases for more information on what has changed recently.
Contributing
Pull requests are more than welcome. You must follow the PSR coding standards.
Security
Please review our security policy on how to report security vulnerabilities.
License
The MIT License (MIT). Please see LICENSE for more information.
vectorifyai/vectorify-php 适用场景与选型建议
vectorifyai/vectorify-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.83k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 07 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「sdk」 「Agent」 「vector」 「ai」 「mcp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vectorifyai/vectorify-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vectorifyai/vectorify-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vectorifyai/vectorify-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Custom laravel monolog logger for datadog logs management, both api and agent ways
The Message Submission Agent Diagnostics tool (msadiag) facilitates testing the compatibility of third party message submission agents.
Standalone replacement for php's native get_browser() function
A PHP desktop/mobile user agent parser with support for Laravel, based on Mobiledetect
Random user agent generator in PHP.
Alfabank REST API integration
统计信息
- 总下载量: 5.83k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 23
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-06