Download the PHP package bitarun/laravel-notification-service without Composer

On this page you can find all versions of the php package bitarun/laravel-notification-service. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-notification-service

📦 Laravel Notification Service

Latest Version Total Downloads PHP Version Laravel Version License

🇮🇷 فارسی • 🇬🇧 English


فارسی

یک پکیج ساده، تمیز و انعطاف‌پذیر برای ارسال نوتیفیکیشن (ایمیل و پیامک) در پروژه‌های Laravel

✨ ویژگی‌ها


📱 پیش‌نیاز سرویس پیامک (SMS)

این پکیج برای ارسال پیامک به‌صورت اختصاصی بر اساس ساختار API سرویس sms.ir (به‌طور دقیق‌تر، متد ارسال پیامک تایید بر پایه‌ی قالب/Template) پیاده‌سازی شده است.

⚠️ توجه: این بخش از پکیج با سایر سرویس‌های پیامکی (مثل کاوه‌نگار، ملی‌پیامک و...) تست یا سازگار نشده و به‌احتمال زیاد به‌دلیل تفاوت در ساختار درخواست/پاسخ API، بدون تغییر در کد کار نخواهد کرد. برای استفاده از این قابلیت باید حتماً از سرویس sms.ir استفاده کنید.

برای استفاده از قابلیت ارسال پیامک، پیش از هر چیز باید:

  1. در سایت sms.ir ثبت‌نام کنید.
  2. یک API Key از پنل کاربری خود دریافت کنید.
  3. یک قالب (Template) برای ارسال پیامک تایید بسازید و شناسهٔ قالب (Template ID) آن را یادداشت کنید.
  4. مقادیر دریافتی را در فایل .env پروژه‌تان قرار دهید (به بخش تنظیمات مراجعه کنید).

📥 نصب

از طریق Composer نصب کنید:

پکیج به‌صورت خودکار (Auto-Discovery) توسط لاراول شناسایی می‌شود و نیازی به ثبت دستی Service Provider نیست.

انتشار فایل تنظیمات

این دستور فایل config/notification.php را در پروژهٔ شما ایجاد می‌کند.


⚙️ تنظیمات

پس از انتشار فایل کانفیگ، مقادیر زیر را در فایل .env پروژه‌تان تنظیم کنید:

کلید توضیح پیش‌فرض
NOTIFICATION_QUEUE_ENABLED آیا نوتیفیکیشن‌ها به‌صورت پیش‌فرض وارد صف شوند؟ false
NOTIFICATION_QUEUE_CONNECTION کانکشن صف مورد استفاده کانکشن پیش‌فرض لاراول
NOTIFICATION_QUEUE_NAME نام صف مورد استفاده default
SMS_API_KEY کلید API که از پنل کاربری sms.ir دریافت می‌کنید —
SMS_URL آدرس endpoint سرویس پیامکی sms.ir (نیازی به تغییر ندارد) https://api.sms.ir/v1/send/verify
SMS_TEMPLATE_ID شناسهٔ قالبی که در پنل sms.ir برای ارسال پیامک تایید ساخته‌اید —

🚀 شروع سریع

📧 ارسال ایمیل

📱 ارسال پیامک

همین! به همین سادگی 🎉


🎯 استفاده از DTO گیرنده (اختیاری)

اگر نیاز به اطلاعات بیشتری از گیرنده دارید (مثلاً نام، برای استفاده در قالب ایمیل)، می‌توانید از NotificationRecipient استفاده کنید:

💡 هر دو روش (رشتهٔ ساده یا DTO کامل) به‌طور یکسان پشتیبانی می‌شوند و می‌توانید بر اساس نیاز خود انتخاب کنید.


🚦 مدیریت صف (Queue)

به‌صورت پیش‌فرض، رفتار صف بر اساس مقدار NOTIFICATION_QUEUE_ENABLED در فایل .env تعیین می‌شود. اما می‌توانید این رفتار را به‌صورت مستقیم و per-call نیز override کنید:

اجبار به ارسال از طریق صف

اجبار به ارسال فوری (بدون صف)

رفتار پیش‌فرض (طبق تنظیمات .env)


🛡️ مدیریت خطا

در صورت بروز خطا در ارسال (مثلاً fail شدن درخواست به سرویس پیامکی)، یک Exception اختصاصی پرتاب می‌شود که می‌توانید آن را مدیریت کنید:

⚙️ در صورت استفاده از صف، این خطاها به‌صورت خودکار توسط مکانیزم failed_jobs لاراول مدیریت می‌شوند.


📋 پیش‌نیازها

نیازمندی نسخه
PHP 8.1 یا بالاتر
Laravel 11.x, 12.x یا بالاتر
حساب کاربری در sms.ir برای استفاده از قابلیت ارسال پیامک

🤝 مشارکت

پیشنهادات، گزارش باگ و Pull Request‌ها با آغوش باز پذیرفته می‌شوند! لطفاً پیش از ارسال تغییرات بزرگ، یک Issue باز کنید تا در موردش گفتگو کنیم.


📄 لایسنس

این پکیج تحت لایسنس MIT منتشر شده است.

🇬🇧 English


English

A simple, clean, and flexible notification package (Email & SMS) for Laravel projects

✨ Features


📱 SMS Service Prerequisite

This package's SMS sending feature is implemented specifically against the API structure of sms.ir (more precisely, its template-based verification SMS method).

⚠️ Note: This part of the package has not been tested or made compatible with other SMS providers (e.g. Kavenegar, Melipayamak, etc.), and due to differences in request/response structure it will most likely not work with them without code changes. You must use sms.ir to use this feature.

Before using the SMS feature, you need to:

  1. Sign up at sms.ir.
  2. Get an API Key from your user panel.
  3. Create a Template for sending verification SMS and note its Template ID.
  4. Put these values in your project's .env file (see the Configuration section).

📥 Installation

Install via Composer:

The package is automatically discovered by Laravel, so there's no need to register the Service Provider manually.

Publish the config file

This command creates the config/notification.php file in your project.


⚙️ Configuration

After publishing the config file, set the following values in your project's .env file:

Key Description Default
NOTIFICATION_QUEUE_ENABLED Whether notifications are queued by default false
NOTIFICATION_QUEUE_CONNECTION The queue connection to use Laravel's default connection
NOTIFICATION_QUEUE_NAME The queue name to use default
SMS_API_KEY API key obtained from your sms.ir user panel —
SMS_URL The sms.ir SMS service endpoint (no need to change) https://api.sms.ir/v1/send/verify
SMS_TEMPLATE_ID The template ID created in your sms.ir panel for sending verification SMS —

🚀 Quick Start

📧 Sending an Email

📱 Sending an SMS

That's it! 🎉


🎯 Using a Recipient DTO (Optional)

If you need more recipient information (e.g. a name, for use in an email template), you can use NotificationRecipient:

💡 Both approaches (a simple string or a full DTO) are equally supported, and you can pick whichever fits your needs.


🚦 Queue Management

By default, queue behavior is determined by the NOTIFICATION_QUEUE_ENABLED value in your .env file. However, you can also override this behavior directly on a per-call basis:

Force sending via the queue

Force immediate sending (no queue)

Default behavior (per .env settings)


🛡️ Error Handling

If a sending error occurs (e.g. a failed request to the SMS service), a dedicated exception is thrown that you can handle:

⚙️ When using the queue, these errors are automatically handled by Laravel's failed_jobs mechanism.


📋 Requirements

Requirement Version
PHP 8.1 or higher
Laravel 11.x, 12.x or higher
An sms.ir account Required for the SMS feature

🤝 Contributing

Suggestions, bug reports, and pull requests are welcome! Please open an issue before submitting major changes so we can discuss it first.


📄 License

This package is released under the MIT License.

🇬🇧 English


Made with ❤️ by Bitarun


All versions of laravel-notification-service with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bitarun/laravel-notification-service contains the following files

Loading the files please wait ...