codebuglab/letsbot-php
Composer 安装命令:
composer require codebuglab/letsbot-php
包简介
Official PHP client for the LetsBot WhatsApp Business API. Seamlessly integrate WhatsApp messaging into your PHP & Laravel applications to automate customer communication, build chatbots, send notifications, and manage interactions.
README 文档
README
A comprehensive PHP package for integrating with the LetsBot WhatsApp API. This package provides a powerful, easy-to-use interface to leverage WhatsApp's extensive messaging capabilities in your PHP applications.
LetsBot transforms business messaging by providing access to WhatsApp's platform, used by 2 billion people worldwide with 60 billion daily messages. Our RESTful API enables you to connect your WhatsApp number to various third-party systems, programming languages, CMS, CRMs & CLI tools with minimal hassle and no complex dependencies.
Table of Contents
- Requirements
- Installation
- Configuration
- Basic Usage
- API Features
- Documentation
- Testing
- Compatibility
- License
- Support
Requirements
- PHP 7.4 or higher
- Guzzle HTTP 7.0 or higher
- A LetsBot account with API credentials
Installation
Laravel
If you're using Laravel, install the package via Composer:
composer require codebuglab/letsbot-php
After installation, publish the configuration file:
php artisan vendor:publish --tag=letsbot-config
You can find the config file in config/letsbot.php.
PHP Native
For PHP native or OOP applications:
require 'vendor/autoload.php'; $lb = (new \LetsBot\Api\LetsBot); $lb::$api_key = 'your_api_key'; // Set API key $lb::$ssl_verify = false; // Set SSL verification (true/false, default is true) $result = $lb->ChatList()->send(); echo json_encode($result);
Configuration
The configuration file contains essential settings for the API connection:
return [ 'api_key' => env('LETS_BOT_API_KEY', 'test'), 'ssl_verify' => true, ];
api_key: Your API key generated from the LetsBot dashboardssl_verify: This option can disable SSL certificate verification if you're in development. Set tofalseto skip SSL certificate errors.
Basic Usage
The package provides an alias LetsBot\Api\LetsBot::class for easy use:
// In Laravel use LetsBot; return LetsBot::sessionStatus()->send(); // OR use the helper function return lb()->sessionStatus()->send();
All methods follow a common pattern:
-
Fluent interface:
LetsBot::method()->param1(value)->param2(value)->send();
-
Array parameter:
LetsBot::method()->send([ 'param1' => value, 'param2' => value ]);
Example: Sending a Text Message
// Fluent interface LetsBot::message() ->phone('1234567890') ->body('Hello from LetsBot!') ->send();
API Features
The LetsBot PHP package provides comprehensive access to all WhatsApp Business API features:
- Message Operations - Send texts, react to messages, reply to specific messages, mentions, and more
- Media Messages - Share images, videos, documents, audio clips, and other media content
- Interactive Messages - Create button messages, list messages, and other interactive content
- Chat Operations - Manage chats, set status, archive conversations, and more
- Group Operations - Create and manage groups, add/remove participants, and group settings
- User Operations - Check presence, manage profiles, block/unblock users
- Product Operations - Manage product catalogs and listings
- Instance Operations - Manage your WhatsApp instance settings and status
- Authentication - Handle QR codes and session management
Documentation
For detailed documentation on all available features and methods, please refer to the following guides:
- Message Operations - Text messages, stickers, reactions, replies, and message management
- Media Messages - Images, videos, files, audio, and other media types
- Button Messages - Interactive button messages with various configurations
- List Messages - Structured lists with sections and items
- Chat Operations - Managing conversations and chat settings
- Group Operations - Creating and managing groups
- User Operations - User management and profiles
- Product Operations - Product catalogs and management
- Instance Operations - Instance configuration and status
- QR Code and Sessions - Authentication and session management
Testing
The package includes comprehensive test coverage. To run tests:
composer test
To generate code coverage reports:
composer test-coverage
This will generate an HTML code coverage report in the coverage directory.
Compatibility
This package is tested with PHP 7.4, 8.0, 8.1, and 8.2 to ensure maximum compatibility across different environments and projects.
License
The MIT License (MIT). Please see License File for more information.
Support
Need assistance? Contact the LetsBot support team:
- Email: sales@letsbot.net
- Phone/WhatsApp: +966559408401
- Documentation: https://docs.letsbot.net
codebuglab/letsbot-php 适用场景与选型建议
codebuglab/letsbot-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 667 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 08 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「client」 「communication」 「messaging」 「notification」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codebuglab/letsbot-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codebuglab/letsbot-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codebuglab/letsbot-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
Client for Google Directions API to add interpolated points to a route consisting of given coordinates.
Alfabank REST API integration
A Flickr wrapper to allow you to call the Flickr api with Guzzle as the backend.Goal is to have 100% Flickr api coverage rather than just upload/display photos (currently at 23%).
统计信息
- 总下载量: 667
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-06