Download the PHP package ashrafcodes/wasenderapi-laravel without Composer
On this page you can find all versions of the php package ashrafcodes/wasenderapi-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ashrafcodes/wasenderapi-laravel
More information about ashrafcodes/wasenderapi-laravel
Files in ashrafcodes/wasenderapi-laravel
Package wasenderapi-laravel
Short Description Laravel package for WasenderAPI WhatsApp sessions, messages, contacts, groups, channels, uploads, and webhooks.
License MIT
Informations about the package wasenderapi-laravel
WasenderAPI Laravel Package
Laravel package for WasenderAPI, built to help you manage WhatsApp sessions, send messages, handle media, work with contacts, groups, channels, and receive webhooks from Laravel.
العربية
نبذة
هذه الحزمة توفر واجهة Laravel سهلة للتعامل مع WasenderAPI بدل كتابة طلبات HTTP يدويًا في كل مشروع. بعد تثبيتها يمكنك استخدام Facade جاهز مثل:
المتطلبات
- PHP 8.1 أو أحدث
- Laravel 10 أو 11 أو 12 أو 13
- Composer
- حساب WasenderAPI
Personal Access Tokenلإدارة الجلساتSession API Keyلإرسال الرسائل والتعامل مع الجلسة
التثبيت من GitHub
ثبت الحزمة:
أو:
بعد التثبيت، انشر ملف الإعدادات:
إعداد ملف .env
أضف القيم التالية داخل مشروع Laravel:
الفرق بين المفاتيح
WASENDERAPI_PERSONAL_ACCESS_TOKEN: يستخدم لإدارة الجلسات مثل إنشاء جلسة، عرض الجلسات، إعادة تشغيل جلسة، حذف جلسة، وتجديد API key.WASENDERAPI_API_KEY: يستخدم لعمليات الجلسة نفسها مثل إرسال الرسائل، حالة الجلسة، جهات الاتصال، المجموعات، والقنوات.
الحزمة تختار المفتاح المناسب تلقائيًا في أغلب الطرق.
إرسال رسالة نصية
إرسال صورة
إرسال فيديو
إرسال ملف
إرسال موقع
إرسال Poll
أنواع الرسائل المدعومة
text($to, $text, $extra = [])image($to, $imageUrl, $text = null, $extra = [])video($to, $videoUrl, $text = null, $extra = [])document($to, $documentUrl, $text = null, $fileName = null, $extra = [])audio($to, $audioUrl, $extra = [])sticker($to, $stickerUrl, $extra = [])contactCard($to, $contact, $extra = [])location($to, $latitude, $longitude, $name = null, $address = null, $extra = [])poll($to, $question, $options, $multiSelect = false, $extra = [])quoted($to, $text, $quoted, $extra = [])withMentions($to, $text, $mentions, $extra = [])viewOnce($to, $media, $extra = [])
إدارة الرسائل
رفع الوسائط وفك تشفيرها
إدارة الجلسات
عمليات جلسة API key:
جهات الاتصال
المجموعات
القنوات
الويبهوكس
الحزمة تضيف مسارًا افتراضيًا:
عند وصول webhook صحيح، تطلق الحزمة event باسم WasenderWebhookReceived:
لتغيير مسار الويبهوك:
لتعطيل المسار الافتراضي وبناء controller خاص بك:
استخدام endpoint غير موجود كطريقة جاهزة
التعامل مع الأخطاء
افتراضيًا، الحزمة ترمي WasenderApiException عند فشل الطلب:
لتعطيل رمي الاستثناءات:
لإرجاع headers وحالة HTTP داخل الرد:
مشاكل شائعة
إذا أردت إزالة الحزمة من مشروع Laravel، لا تكتب رقم الإصدار مع أمر الإزالة:
إذا ظهر خطأ أن Composer وجد v1.0.0 فقط ولم يجد ^1.1، فهذا يعني أن مستودع GitHub لا يحتوي tag باسم v1.1.0 أو أحدث. أنشئ tag من مستودع الحزمة ثم ارفعه:
بعدها ثبّت النسخة المستقرة:
إذا أردت استخدام آخر كود من الفرع main بدون tag، ثبّت نسخة التطوير:
إذا كان مشروعك يستخدم Laravel/Illuminate أحدث من المدعوم في v1.0.0، لا تثبت ^1.0؛ استخدم dev-main أو أنشئ tag جديد مثل v1.1.0.
إذا كان Composer يستخدم cache قديمًا:
إذا لم يجد Composer الحزمة، تأكد من تعريف repository:
تشغيل الاختبارات
English
Overview
This package provides a Laravel-friendly wrapper for WasenderAPI. It lets you manage WhatsApp sessions, send messages, upload and decrypt media, work with contacts, groups, channels, and receive webhook events without writing raw HTTP requests in every project.
Basic usage:
Requirements
- PHP 8.1 or higher
- Laravel 10, 11, 12, or 13
- Composer
- WasenderAPI account
Personal Access Tokenfor account/session managementSession API Keyfor messaging and session-level operations
Installation From GitHub
Install Packagist:
Or:
Publish the configuration file:
Environment Configuration
Add these values to your Laravel .env file:
Token Types
WASENDERAPI_PERSONAL_ACCESS_TOKEN: Used for account-level session management, such as creating, listing, restarting, deleting sessions, and regenerating API keys.WASENDERAPI_API_KEY: Used for session-level actions, such as sending messages, checking status, contacts, groups, and channels.
The package automatically uses the proper token for the built-in methods.
Send a Text Message
Send an Image
Send a Video
Send a Document
Send a Location
Send a Poll
Supported Message Methods
text($to, $text, $extra = [])image($to, $imageUrl, $text = null, $extra = [])video($to, $videoUrl, $text = null, $extra = [])document($to, $documentUrl, $text = null, $fileName = null, $extra = [])audio($to, $audioUrl, $extra = [])sticker($to, $stickerUrl, $extra = [])contactCard($to, $contact, $extra = [])location($to, $latitude, $longitude, $name = null, $address = null, $extra = [])poll($to, $question, $options, $multiSelect = false, $extra = [])quoted($to, $text, $quoted, $extra = [])withMentions($to, $text, $mentions, $extra = [])viewOnce($to, $media, $extra = [])
Message Management
Media Upload and Decryption
Session Management
Session API key methods:
Contacts
Groups
Channels
Webhooks
The package registers this default webhook endpoint:
When a valid webhook is received, the package dispatches WasenderWebhookReceived:
To change the webhook route:
To disable the default route and use your own controller:
Calling Custom Endpoints
If WasenderAPI adds an endpoint that does not have a dedicated method yet, use the generic HTTP helpers:
Error Handling
By default, failed requests throw WasenderApiException:
To disable exceptions:
To include HTTP status and response headers in the returned array:
Troubleshooting
To remove the package from a Laravel project, do not include a version constraint:
If Composer says it found only v1.0.0 and cannot install ^1.1, your GitHub repository does not have a v1.1.0 or newer tag yet. Create and push the tag from the package repository:
Then install the stable version:
If you want to use the latest code from the main branch without a tag, install the development branch:
If your project uses a Laravel/Illuminate version newer than what v1.0.0 supports, do not install ^1.0; use dev-main or create a newer tag such as v1.1.0.
If Composer is using stale package metadata:
If Composer cannot find the package, make sure the GitHub repository is registered:
Testing
Official WasenderAPI Documentation
License
MIT
All versions of wasenderapi-laravel with dependencies
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0