Download the PHP package crenspire/laravel-whatsapp without Composer
On this page you can find all versions of the php package crenspire/laravel-whatsapp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-whatsapp
Laravel WhatsApp Business API Package
A comprehensive Laravel package for integrating with the WhatsApp Business Cloud API. This package provides a clean, easy-to-use interface for sending messages, handling webhooks, managing media, and supporting multi-tenant applications.
Features
- ✅ Complete Message Types: Text, media, templates, interactive messages (buttons, lists), contacts, location, stickers, reactions, flows, and product messages
- ✅ Fluent API: Builder patterns for easy message construction with
MessageBuilderandTemplateBuilder - ✅ Webhook Support: Secure webhook handling with signature verification and comprehensive message type processing
- ✅ Media Management: Upload, download, info retrieval, and deletion with automatic type detection via
MediaManager - ✅ Business Profile Management: Get and update business profile information via
BusinessProfileManager - ✅ Multi-tenant Support: Per-tenant configuration for phone numbers and access tokens
- ✅ Rate Limiting: Built-in rate limiting to respect WhatsApp API limits
- ✅ Event System: Laravel events for message status updates and incoming messages
- ✅ Comprehensive Testing: Full test coverage with realistic scenarios
- ✅ Security: Webhook verification and signature validation
- ✅ Logging: Detailed logging for debugging and monitoring
- ✅ Clean Architecture: Separated concerns with dedicated managers and builders
Installation
1. Install the Package
2. Publish Configuration
3. Configure Environment Variables
Add these variables to your .env file:
4. Set Up Webhook Routes
The package automatically registers webhook routes. Make sure your webhook URL is configured in your WhatsApp Business API settings:
- Verification URL:
https://yourdomain.com/whatsapp/webhook - Webhook URL:
https://yourdomain.com/whatsapp/webhook
Quick Start
Basic Usage
Using the Service Directly
Message Types
Text Messages
Media Messages
Template Messages
Interactive Messages
Button Messages
List Messages
Media Management
Upload Media
Download Media
Multi-tenant Support
Configure multiple WhatsApp Business accounts:
Use tenant-specific configuration:
Webhook Handling
Event Listeners
The package dispatches several events that you can listen to:
Example Event Listener
Error Handling
The package throws WhatsappException for various error conditions:
Rate Limiting
The package includes built-in rate limiting to respect WhatsApp API limits:
Logging
Enable debug logging:
Or set in your .env:
Testing
Run the test suite:
The package includes comprehensive tests covering all functionality.
Security
Webhook Verification
The package automatically verifies webhook signatures when WHATSAPP_WEBHOOK_SECRET is configured:
Phone Number Validation
All phone numbers are validated before sending messages to ensure they meet WhatsApp's requirements.
🔧 Custom Headers Support
The package now supports custom headers for all API requests, allowing you to add authentication, tracking, or other custom headers:
Basic Usage
Multi-tenant Headers
Configure per-tenant headers in your configuration:
Default Headers
Set default headers for all requests:
Header Priority
Headers are merged in the following order (later overrides earlier):
- Default headers from configuration
- Tenant-specific headers
- Custom headers passed to individual methods
Configuration Reference
See Configuration for detailed configuration options.
API Reference
See API Reference for complete method documentation.
Enhanced Features
New Message Types
The package now supports all WhatsApp Cloud API message types:
- Contact Messages: Send contact cards
- Location Messages: Share location with optional name and address
- Sticker Messages: Send stickers
- Reaction Messages: React to existing messages
- Flow Messages: Send interactive flows
- Product Messages: Single and multi-product catalogs
Fluent API
Use the new builder patterns for cleaner code:
Business Profile Management
Enhanced Media Management
Examples
See Examples for real-world usage examples.
Troubleshooting
See Troubleshooting for common issues and solutions.
Contributing
Contributions are welcome! Please see Contributing for guidelines.
License
This package is open-sourced software licensed under the MIT license.
All versions of laravel-whatsapp with dependencies
illuminate/contracts Version ^10.0|^11.0|^12.0
spatie/laravel-package-tools Version ^1.14
nesbot/carbon Version ^2.0|^3.0
guzzlehttp/guzzle Version ^7.0