An open API service indexing awesome lists of open source software.

https://github.com/gabrielesbaiz/whatsapp-toolkit

A helper package to handle WhatsApp messages using api.whatsapp.com
https://github.com/gabrielesbaiz/whatsapp-toolkit

laravel-package php

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# WhatsappToolkit

[![Latest Version on Packagist](https://img.shields.io/packagist/v/gabrielesbaiz/whatsapp-toolkit.svg?style=flat-square)](https://packagist.org/packages/gabrielesbaiz/whatsapp-toolkit)
[![Total Downloads](https://img.shields.io/packagist/dt/gabrielesbaiz/whatsapp-toolkit.svg?style=flat-square)](https://packagist.org/packages/gabrielesbaiz/whatsapp-toolkit)

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:

```bash
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`:

```bash
'providers' => [
Gabrielesbaiz\WhatsappToolkit\WhatsappToolkitServiceProvider::class,
],
```
And the facades:

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

## Usage

```php
$whatsappToolkit = new Gabrielesbaiz\WhatsappToolkit();

echo $whatsappToolkit->url('+39 1234567890', '

Hallo world!

'); // https://api.whatsapp.com/send?phone=%2B39+1234567890&text=Hallo+world%21
```

Using facade:

```php
use WhatsappToolkit;

WhatsappToolkit::url('+39 1234567890', '

Hallo world!

'); // https://api.whatsapp.com/send?phone=%2B39+1234567890&text=Hallo+world%21
WhatsappToolkit::formatMessage('

Hallo world!

'); // Hallo+world%21
WhatsappToolkit::formatPhoneNumber('+39 1234567890'); // %2B39+1234567890
```

## Testing

```bash
composer test
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

- [Gabriele Sbaiz](https://github.com/gabrielesbaiz)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.