mosamy/whatsapp
Composer 安装命令:
composer require mosamy/whatsapp
包简介
Laravel package to integrate WhatsApp Business API.
README 文档
README
This package provides tools and utilities for interacting with WhatsApp services. Below is a detailed guide to help you get started.
Installation
To install the package, use the following command:
composer require mosamy/whatsapp
Features
- Message Sending: Send text, images, and other media to WhatsApp users.
Usage
Usage in Laravel
To use the WhatsApp package in a Laravel application, follow these steps:
- Install the Package
Ensure the package is installed via Composer:composer require mosamy/whatsapp Configure the Package
After installation, add the following CloudWA configuration to your
.envfile:CLOUDWA_USERNAME=your_cloudwa_username CLOUDWA_PASSWORD=your_cloudwa_password CLOUDWA_SESSION_UUID=your_session_uuid CLOUDWA_REPORT_EMAIL=your_report_emailReplace
your_cloudwa_username,your_cloudwa_passwordandyour_session_uuidwith the appropriate values for your CloudWA account.If any error occurs, a report will be sent to the email configured in
CLOUDWA_REPORT_EMAIL.Sending a Message
Use theWhatsApphelper to easily send a message:whatsapp()->send([ 'to' => '+1234567890', 'message' => 'Hello from Laravel!', ]);## Advanced Usage
For more advanced features, you can create a page to display the session status. The following example is compatible with Livewire, but you can customize it to suit your needs.
### Step 1: Create a Livewire Component
First, create a Livewire component to handle the session status:
use Livewire\Component; use ServicesCloudWA; class WhatsappSessionStatus extends Component { #[Computed] public function sessionStatus() { return ServicesCloudWA::sessionStatus(); } }### Step 2: Create a Blade View
Next, create a Blade file named
whatsapp-session-status.blade.phpto display the session status:<div class="card-body text-center"> <div wire:poll.10s="$refresh"> <div class="text-danger">{{ $this->sessionStatus['message'] ?? $this->sessionStatus['errors'][0] ?? '' }}</div> @if((($this->sessionStatus['status'] ?? '') != 'CONNECTED')) <div class="mt-2"> <img class="qrcode" src="{{ $this->sessionStatus['qrcode'] ?? asset('style/images/qr-code-placeholder.png') }}" style="border: 1px solid white; height: 192px; width: 192px;" alt="QRCode Loading"> </div> @endif </div> <x-webadmin.buttons.button label="Refresh" type="button" wire:click="$refresh" class="btn mt-4 btn-secondary"> Refresh </x-webadmin.buttons.button> </div>### Step 3: Define the Route
Finally, define a route to serve the Livewire component:
use App\Http\Livewire\WhatsappSessionStatus; Route::get('whatsapp-session-status', WhatsappSessionStatus::class)->name('whatsapp-session-status');This setup will allow you to monitor the session status in real-time and refresh the QR code or status as needed.
For additional details, consult the official documentation or open an issue for support.
Contributing
Contributions are welcome! Please submit a pull request or open an issue for any bugs or feature requests.
Support
For support, please contact dev.mohamed.samy@gmail.com.
mosamy/whatsapp 适用场景与选型建议
mosamy/whatsapp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mosamy/whatsapp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mosamy/whatsapp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-03