PHPackages                             patelg10/green-api-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. patelg10/green-api-laravel

ActiveLibrary[API Development](/categories/api)

patelg10/green-api-laravel
==========================

A clean Laravel wrapper for the Green API WhatsApp service.

v1.0.1(3mo ago)00MITPHPPHP ^8.1

Since Feb 18Pushed 3mo agoCompare

[ Source](https://github.com/patelg10/green-api-laravel)[ Packagist](https://packagist.org/packages/patelg10/green-api-laravel)[ RSS](/packages/patelg10-green-api-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Green API WhatsApp Laravel Wrapper
==================================

[](#green-api-whatsapp-laravel-wrapper)

[![Latest Version on Packagist](https://camo.githubusercontent.com/826180865bc7cb3dad6265f7bf4e02add633a55d7723e82333cdf3298f9609fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796f75726e616d652f677265656e2d6170692d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yourname/green-api-laravel)[![Total Downloads](https://camo.githubusercontent.com/1ee74f70773589c856a54542448002ae405c7dbd7c5466479a06e66a51f895d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f796f75726e616d652f677265656e2d6170692d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yourname/green-api-laravel)[![License](https://camo.githubusercontent.com/90b23dd730a662b139c107187de39cffecd5e60cd5003611a84948d528d82314/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f796f75726e616d652f677265656e2d6170692d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yourname/green-api-laravel)

A professional, expressive Laravel wrapper for the [Green API](https://green-api.com/). This package provides a seamless way to integrate WhatsApp messaging into your Laravel applications using clean OOP principles, Facades, and an event-driven webhook system.

---

🚀 Features
----------

[](#-features)

- ✅ **Quick Setup** – Automatic package discovery and configuration publishing.
- ✅ **Fluent API** – Simple `GreenApi` facade for sending text and media.
- ✅ **Webhook Ready** – Built-in endpoint and event dispatcher for incoming messages.
- ✅ **Developer Friendly** – Full IDE auto-completion support via DocBlocks.
- ✅ **Clean Architecture** – Follows Laravel best practices.

---

📦 Installation
--------------

[](#-installation)

**Install the package via Composer:**

```
composer require patelg10/green-api-laravel
```

**Publish the configuration file:**

```
php artisan vendor:publish --tag="greenapi-config"
```

⚙️ Configuration
----------------

[](#️-configuration)

**Add your Green API credentials to your .env file. You can find these in your Green API console.**

```
GREEN_API_ID_INSTANCE=your_id_instance_here
GREEN_API_TOKEN_INSTANCE=your_api_token_here
GREEN_API_HOST=https://api.green-api.com

```

🛠 Usage
-------

[](#-usage)

**Sending a Text Message**

The package uses a Facade to make sending messages simple:

```
use YourName\GreenApi\Facades\GreenApi;

// Send message to a phone number (e.g., 1234567890@c.us)
GreenApi::sendMessage(
    '1234567890@c.us',
    'Hello! This is a test message from Laravel.'
);

```

**Sending a File (via URL)**

Send documents, images, or videos by providing a public URL:

```
use YourName\GreenApi\Facades\GreenApi;

GreenApi::sendFileByUrl(
    '1234567890@c.us',
    'https://example.com/invoice.pdf',
    'invoice.pdf',
    'Please find your invoice attached.'
);

```

🔔 Handling Webhooks (Incoming Messages)
---------------------------------------

[](#-handling-webhooks-incoming-messages)

This package automatically registers a POST route at:

```
/greenapi/webhook

```

This endpoint listens for events from Green API and dispatches a Laravel Event.

**Step 1: Create a Listener**

Generate a listener in your application:

```
php artisan make:listener HandleWhatsAppWebhook

```

**Step 2: Register the Listener**

In your App\\Providers\\EventServiceProvider.php:

```
use YourName\GreenApi\Events\WebhookReceived;
use App\Listeners\HandleWhatsAppWebhook;

protected $listen = [
    WebhookReceived::class => [
        HandleWhatsAppWebhook::class,
    ],
];

```

**Step 3: Implement the Logic**

In HandleWhatsAppWebhook.php:

```
namespace App\Listeners;

use YourName\GreenApi\Events\WebhookReceived;

class HandleWhatsAppWebhook
{
    public function handle(WebhookReceived $event)
    {
        $payload = $event->payload;

        // Check if the webhook is an incoming message
        if ($payload['typeWebhook'] === 'incomingMessageReceived') {
            $sender = $payload['senderData']['sender'];
            $message = $payload['messageData']['textMessageData']['textMessage'] ?? '';

            // Your business logic here (Save to DB, reply, etc.)
            \Log::info("New WhatsApp from {$sender}: {$message}");
        }
    }
}

```

🧪 Testing
---------

[](#-testing)

If you are contributing to the package, you can run tests using:

```
composer test

```

🛡 Security
----------

[](#-security)

If you discover any security-related issues, please email, Instead of using the issue tracker.

```
patelg10@gmail.com

```

📄 License
---------

[](#-license)

This package is open-sourced software licensed under the **MIT License.**

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

90d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d78c11dc39213dbda1203e2132d4a8d20314f6392ec0e9ad05cebe82f3aa9802?d=identicon)[patelg10](/maintainers/patelg10)

---

Top Contributors

[![sipupjiten](https://avatars.githubusercontent.com/u/195815977?v=4)](https://github.com/sipupjiten "sipupjiten (5 commits)")[![patelg10](https://avatars.githubusercontent.com/u/43615860?v=4)](https://github.com/patelg10 "patelg10 (2 commits)")

### Embed Badge

![Health badge](/badges/patelg10-green-api-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/patelg10-green-api-laravel/health.svg)](https://phpackages.com/packages/patelg10-green-api-laravel)
```

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1344.8k1](/packages/jasara-php-amzn-selling-partner-api)[grantholle/powerschool-api

A Laravel package to make interacting with PowerSchool less painful.

1715.6k1](/packages/grantholle-powerschool-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
