gabrielesbaiz/whatsapp-toolkit

A lightweight heklper package to handle WhatsApp messages using api.whatsapp.com

1.3.0 2025-03-02 20:54 UTC

This package is auto-updated.

Last update: 2025-03-02 20:55:26 UTC


README

Latest Version on Packagist Total Downloads

A lightweight helper package to handle WhatsApp messages using api.whatsapp.com

Features

  • ✅ URL generator for api.whatsapp.com
  • ✅ Message formatter from HTML to WhatsApp
  • ✅ PhoneNumber formatter

Installation

You can install the package via composer:

composer require gabrielesbaiz/whatsapp-toolkit

Laravel will automatically register the service provider and facades.

If necessary, you can manually add the service provider in config/app.php:

'providers' => [
    Gabrielesbaiz\WhatsappToolkit\WhatsappToolkitServiceProvider::class,
],

And the facades:

'aliases' => [
    'WhatsappToolkit' => Gabrielesbaiz\WhatsappToolkit\Facades\WhatsappToolkit::class,
],

Usage

$whatsappToolkit = new Gabrielesbaiz\WhatsappToolkit();

echo $whatsappToolkit->url('+39 1234567890', '<p>Hallo world!</p>'); // https://api.whatsapp.com/send?phone=%2B39+1234567890&text=Hallo+world%21

Using facade:

use WhatsappToolkit;

WhatsappToolkit::url('+39 1234567890', '<p>Hallo world!</p>'); // https://api.whatsapp.com/send?phone=%2B39+1234567890&text=Hallo+world%21
WhatsappToolkit::formatMessage('<p>Hallo world!</p>'); // Hallo+world%21
WhatsappToolkit::formatPhoneNumber('+39 1234567890'); // %2B39+1234567890

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.