Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Kavenegar Laravel Laravel Package

ariaieboy/kavenegar-laravel

Laravel integration for the Kavenegar SMS API. Install via Composer, register the service provider and facade, publish config, and set your API key. Then send messages anywhere in your app using the Kavenegar facade.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Purpose Alignment: The package (kavenegar-laravel) integrates Kavenegar, an Iranian SMS gateway, with Laravel, enabling SMS notifications via a clean facade/manager pattern. This aligns well with Laravel’s ecosystem (e.g., Notification channels) but lacks native Laravel compatibility (e.g., no via() support in notifications).
  • Design Patterns: Follows a service provider + facade pattern, which is familiar to Laravel developers. However, the package is minimalist (no queue support, no retries, no logging abstraction), requiring customization for production-grade reliability.
  • Laravel Version Support: No explicit Laravel version constraints in the codebase (risk of compatibility issues with newer Laravel versions). The package assumes PHP 8.x but lacks type hints or strict typing.

Integration Feasibility

  • Core Features:
    • Send SMS via Kavenegar API (basic functionality works).
    • Configurable via .env (e.g., KAVENEGAR_API_KEY).
    • No built-in rate limiting, exponential backoff, or webhook validation (critical for SMS gateways).
  • Missing Laravel Integrations:
    • No Notification channel (must manually integrate with Notifiable).
    • No queue support (blocks async processing).
    • No event dispatching (e.g., SmsSent events).
  • API Stability: Kavenegar’s API may change; the package has no API versioning or fallback logic.

Technical Risk

  • High Customization Burden:
    • Requires manual implementation of:
      • Queueable SMS jobs.
      • Retry logic for failed sends.
      • Logging/monitoring (e.g., failed SMS tracking).
    • No tests or documentation (risk of undetected bugs).
  • Archived Status:
    • Last release in March 2024, but no stars/issues suggest low adoption. Risk of abandonment.
    • No CI/CD or dependency updates (e.g., Guzzle HTTP client may be outdated).
  • Security Risks:
    • API key stored in .env (no encryption or rotation support).
    • No input validation for SMS payloads (risk of injection if used with user-provided data).

Key Questions

  1. Why not use a maintained alternative (e.g., spatie/laravel-sms-notifications or custom Kavenegar HTTP client)?
  2. What are the non-functional requirements (e.g., async processing, retries, logging) that this package doesn’t address?
  3. Is Kavenegar the only SMS provider needed, or will this require future multi-provider support?
  4. How will failures be monitored/alerted (e.g., failed SMS deliveries)?
  5. Is the package’s MIT license acceptable for the project’s compliance needs?

Integration Approach

Stack Fit

  • Laravel Compatibility:
    • Works with Laravel 8+ (PHP 8.x), but no explicit version constraints.
    • No native Notification channel support → must integrate manually via:
      // Example: Custom Notification Channel
      use Ariaieboy\Kavenegar\Facades\Kavenegar;
      
      class KavenegarChannel implements ShouldQueue
      {
          public function send(User $notifiable, array $data)
          {
              Kavenegar::send($data['message'], $data['recipients']);
          }
      }
      
  • Dependencies:
    • Requires guzzlehttp/guzzle (managed via Composer).
    • No database migrations or Eloquent models (pure API wrapper).

Migration Path

  1. Short-Term (MVP):
    • Install via Composer:
      composer require ariaieboy/kavenegar-laravel
      
    • Publish config (if needed) and add .env keys:
      KAVENEGAR_API_KEY=your_key
      KAVENEGAR_SENDER=your_sender_id
      
    • Use facade directly:
      use Ariaieboy\Kavenegar\Facades\Kavenegar;
      
      Kavenegar::send("Hello", ["09123456789"]);
      
  2. Medium-Term (Production-Grade):
    • Replace facade with a custom service class to add:
      • Queue support (ShouldQueue).
      • Retry logic (Illuminate\Bus\Queueable).
      • Logging (Monolog integration).
    • Example:
      class KavenegarService
      {
          public function send(string $message, array $recipients): void
          {
              try {
                  Kavenegar::send($message, $recipients);
                  event(new SmsSent($recipients, $message));
              } catch (Exception $e) {
                  Log::error("Kavenegar SMS failed", ['error' => $e]);
                  throw $e;
              }
          }
      }
      
  3. Long-Term (Scalable):
    • Abstract SMS provider behind an interface (e.g., SmsGateway) to support multiple providers.
    • Use Laravel’s Notification channel for consistency.

Compatibility

  • PHP/Laravel:
    • Tested with PHP 8.x and Laravel 8+. May need adjustments for Laravel 9+ (e.g., Symfony 6.x dependencies).
  • Kavenegar API:
    • Assumes API stability. If Kavenegar changes endpoints/parameters, the package may break.
  • Third-Party Risks:
    • Guzzle version may conflict with Laravel’s dependencies (check composer.json).

Sequencing

  1. Phase 1: Basic SMS sends (synchronous, no retries).
  2. Phase 2: Add queue support and retry logic.
  3. Phase 3: Integrate with Laravel Notification system.
  4. Phase 4: Add monitoring (e.g., failed SMS tracking in a failed_jobs table).

Operational Impact

Maintenance

  • Pros:
    • Simple to use for basic SMS sends.
    • MIT license allows modifications.
  • Cons:
    • No active maintenance (archived repo, no issues/PRs).
    • No tests → high risk of regressions.
    • No documentation → onboarding requires reverse-engineering.
  • Mitigation:
    • Fork the repo to add tests/docs.
    • Set up CI (e.g., GitHub Actions) for PHP/Laravel version testing.

Support

  • Limited Community:
    • No GitHub discussions/issues → no peer support.
    • Developer must troubleshoot Kavenegar API issues independently.
  • Debugging:
    • No structured logging → hard to diagnose failures.
    • Workaround: Add custom logging to the facade/service layer.
  • Vendor Lock-in:
    • Tight coupling to Kavenegar API → switching providers requires rewrites.

Scaling

  • Performance:
    • Synchronous by default → blocks HTTP requests.
    • No connection pooling → risk of rate limits on high-volume sends.
  • Scaling Strategies:
    • Use Laravel queues (database/redis) for async processing.
    • Implement batch sending (e.g., 10 SMS per request to avoid rate limits).
    • Consider Kavenegar’s bulk API if available.
  • Cost:
    • No cost-monitoring features (risk of unexpected SMS charges).

Failure Modes

Failure Scenario Impact Mitigation
Kavenegar API downtime SMS not delivered Implement retries + fallback provider.
Invalid API key All SMS fail Validate .env keys at runtime.
Rate limiting Throttled requests Add exponential backoff.
No queue support Blocked HTTP responses Use Laravel queues + ShouldQueue.
No logging Undetected failures Add custom logging (Monolog).
API changes (Kavenegar) Package breaks Abstract API calls behind an interface.

Ramp-Up

  • Developer Onboarding:
    • Low: Basic usage is simple, but production-grade setup requires effort.
    • Documentation Gap: Must create internal docs for:
      • Queue setup.
      • Error handling.
      • Monitoring.
  • Testing:
    • No test suite → manual testing required.
    • Mock Kavenegar API for unit tests (e.g., using VCR or HTTP mocks).
  • Training:
    • Team must understand:
      • SMS gateway limitations (e.g., delivery delays).
      • Kavenegar’s pricing/model.
      • Custom retry logic.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle