承接 zapwize/laravel 相关项目开发

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

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

zapwize/laravel

Composer 安装命令:

composer require zapwize/laravel

包简介

Laravel package for Zapwize WhatsApp Web API integration

README 文档

README

Latest Version on Packagist Total Downloads

This package provides a simple and expressive way to interact with the Zapwize WhatsApp Web API in your Laravel applications. Send text messages, images, videos, documents, and more with ease.

Features

  • Fluent and easy-to-use API
  • Send various message types: text, image, video, audio, document, location, contact, poll
  • Asynchronous message sending using Laravel Queues
  • Webhook handling for incoming messages and status updates
  • Secure webhook signature verification
  • Automatic caching of server information for better performance
  • Configurable logging and connection settings

Installation

You can install the package via composer:

composer require zapwize/laravel

Configuration

  1. Publish the configuration file:

    php artisan vendor:publish --provider="Zapwize\Laravel\ZapwizeServiceProvider" --tag="config"

    This will create a config/zapwize.php file in your application.

  2. Add the following environment variables to your .env file:

    ZAPWIZE_API_KEY=your_zapwize_api_key
    
    # Optional queue settings
    ZAPWIZE_QUEUE_CONNECTION=database
    ZAPWIZE_QUEUE=zapwize

Requirements

  • PHP 8.2 or higher
  • Laravel 9, 10, 11 or 12

Usage

You can use the Zapwize facade to access the client methods.

Sending Messages

Text Message

use Zapwize\Laravel\Facades\Zapwize;

$response = Zapwize::sendMessage('1234567890', 'Hello from Laravel!');

Image Message

use Zapwize\Laravel\Facades\Zapwize;

$media = [
    'url' => 'https://example.com/image.jpg',
    // or 'base64' => 'data:image/jpeg;base64,...'
];

$options = [
    'caption' => 'This is a caption.',
];

$response = Zapwize::sendImage('1234567890', $media, $options);

Video Message

use Zapwize\Laravel\Facades\Zapwize;

$media = [
    'url' => 'https://example.com/video.mp4',
];

$options = [
    'caption' => 'This is a video.',
    'gif' => false, // Set to true for GIF videos
];

$response = Zapwize::sendVideo('1234567890', $media, $options);

Audio Message

use Zapwize\Laravel\Facades\Zapwize;

$media = [
    'url' => 'https://example.com/audio.mp3',
];

$response = Zapwize::sendAudio('1234567890', $media);

Document Message

use Zapwize\Laravel\Facades\Zapwize;

$media = [
    'url' => 'https://example.com/document.pdf',
    'filename' => 'MyDocument.pdf',
];

$response = Zapwize::sendDocument('1234567890', $media);

Location Message

use Zapwize\Laravel\Facades\Zapwize;

$response = Zapwize::sendLocation('1234567890', 37.7749, -122.4194);

Contact Message

use Zapwize\Laravel\Facades\Zapwize;

$contact = [
    'name' => 'John Doe',
    'phone' => '0987654321',
];

$response = Zapwize::sendContact('1234567890', $contact);

Poll Message

use Zapwize\Laravel\Facades\Zapwize;

$poll = [
    'name' => 'What is your favorite color?',
    'options' => ['Red', 'Green', 'Blue'],
    'selectableCount' => 1,
];

$response = Zapwize::sendPoll('1234567890', $poll);

Asynchronous Sending

To send messages without blocking the main thread, you can use the sendMessageAsync method. Make sure your Laravel Queue is configured correctly.

use Zapwize\Laravel\Facades\Zapwize;

Zapwize::sendMessageAsync('1234567890', 'This message is sent asynchronously.');

Webhooks

To handle incoming messages and status updates, you need to set up a webhook.

  1. In your config/zapwize.php, set webhook.enabled to true and configure the webhook.url and webhook.secret.

  2. The package automatically registers the webhook route at /zapwize/webhook. You can customize this in the config file.

  3. Listen for the Zapwize\Laravel\Events\MessageReceived event to process incoming messages:

    In your EventServiceProvider.php:

    protected $listen = [
        \Zapwize\Laravel\Events\MessageReceived::class => [
            \App\Listeners\ProcessIncomingWhatsAppMessage::class,
        ],
    ];

    Create the listener:

    namespace App\Listeners;
    
    use Zapwize\Laravel\Events\MessageReceived;
    
    class ProcessIncomingWhatsAppMessage
    {
        public function handle(MessageReceived $event)
        {
            $messageData = $event->message;
            // Process the incoming message...
        }
    }

Other Methods

Check if a number is a WhatsApp number

use Zapwize\Laravel\Facades\Zapwize;

$isWhatsAppNumber = Zapwize::isWhatsAppNumber('1234567890');

Get Server Information

use Zapwize\Laravel\Facades\Zapwize;

$serverInfo = Zapwize::getServerInfo();

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.

zapwize/laravel 适用场景与选型建议

zapwize/laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「messaging」 「laravel」 「whatsapp」 「webhook」 「zapwize」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 zapwize/laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 zapwize/laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 zapwize/laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-14