fahrigunadi/whatsapp 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

fahrigunadi/whatsapp

最新稳定版本:v1.1.1

Composer 安装命令:

composer require fahrigunadi/whatsapp

包简介

This is my package whatsapp

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Installation

You can install the package via composer:

composer require fahrigunadi/whatsapp

You can publish the config file with:

php artisan vendor:publish --tag="whatsapp-config"

This is the contents of the published config file:

return [
    /**
     * --------------------------------------------------------------------------
     * WhatsApp Driver
     * --------------------------------------------------------------------------
     *
     * This option defines which driver implementation to use for sending
     * WhatsApp messages. You may configure your own custom driver or use
     * one of the available drivers such as 'aldinokemal', 'wuzapi', etc.
     *
     * Supported: "aldinokemal", "wuzapi"
     */
    'driver' => env('WHATSAPP_DRIVER', 'aldinokemal'),

    /**
     * --------------------------------------------------------------------------
     * WhatsApp Username
     * --------------------------------------------------------------------------
     *
     * The username used to authenticate with the selected WhatsApp provider.
     * This value is typically provided by the API service you are integrating with.
     */
    'username' => env('WHATSAPP_USERNAME'),

    /**
     * --------------------------------------------------------------------------
     * WhatsApp Password or Token
     * --------------------------------------------------------------------------
     *
     * The password or access token required to authenticate with the provider.
     * This credential should be kept secure and never exposed publicly.
     */
    'password' => env('WHATSAPP_PASSWORD'),

    /**
     * --------------------------------------------------------------------------
     * WhatsApp Base URL
     * --------------------------------------------------------------------------
     *
     * The base endpoint URL for the WhatsApp API. This is where all requests
     * will be sent. Make sure the URL is correct and includes the necessary
     * protocol (http or https).
     */
    'base_url' => env('WHATSAPP_BASE_URL'),
];

Usage

whatsapp()
    ->to('+628XXXXXXXXXX')
    ->message('Hello World')
    ->send();

whatsapp()
    ->to('+628XXXXXXXXXX')
    ->image('https://files.f-g.my.id/images/dummy/botol-2.jpg')
    ->send();

\FahriGunadi\Whatsapp\Whatsapp::to('+628XXXXXXXXXX')
    ->image('https://files.f-g.my.id/images/dummy/botol-2.jpg')
    ->message('Image Caption')
    ->send();

// handle webhook in controller
public function webhook(\FahriGunadi\Whatsapp\WebhookRequest $request)
{
    // get webhook sender
    $sender = $request->sender();

    // get webhook message text
    $text = $request->messageText();

    // get webhook chat room
    $room = $request->chat();

    // reply webhook message
    $request->reply()->message("Hello $sender, you said: $text")->send();

    // ....
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-02