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

Notifier Laravel Package

byscripts/notifier

Deprecated/soon-to-be-deleted Laravel/PHP notifier package. The author advises not to use it; repository is intended for removal. Not recommended for new projects—look for an actively maintained alternative.

View on GitHub
Deep Wiki
Context7
## Getting Started

### Minimal Setup
1. **Installation**: Since the package is deprecated, verify if a fork or alternative exists. If not, skip installation.
   ```bash
   composer require byscripts/notifier

(Note: This will likely fail due to the package being removed. Use as a reference for similar packages like spatie/notifications or laravel-notification-channels instead.)

  1. Configuration: If exploring for learning, check config/notifier.php (if auto-generated) for:

    • Default channels (e.g., mail, database, slack).
    • Fallback logic for unsupported channels.
  2. First Use Case:

    • Legacy Migration: If maintaining an old app, replace Notifier::send() calls with modern alternatives.
    • Learning: Compare its ChannelManager pattern with Laravel’s Notification facade.

Implementation Patterns

Core Workflow

  1. Define Notifications:

    • Extend ByscriptsNotifier\Notification (if class exists).
    • Example (hypothetical):
      class OrderShipped extends Notification {
          public function via() {
              return ['mail', 'database'];
          }
      }
      
  2. Send Notifications:

    • Use the facade or container:
      Notifier::send($user, new OrderShipped());
      
    • Channel-Specific Logic: Override deliver() in the notification class.
  3. Channels:

    • Register custom channels via Notifier::extend() (if supported).
    • Example (mail channel):
      Notifier::extend('mail', function ($app) {
          return new MailChannel($app['mailer']);
      });
      
  4. Events:

    • Listen for notifier.sent or notifier.failed events (if event system exists).

Integration Tips

  • Laravel 5.0+: Replace with Illuminate\Notifications for:
    • Built-in channels (Slack, SMS, etc.).
    • Queueable notifications.
  • Legacy Apps: Patch the package to use Laravel’s Bus or Events for compatibility.
  • Testing: Mock Notifier facade or use Laravel’s Notification testing helpers.

Gotchas and Tips

Pitfalls

  1. Deprecation:

    • The package is abandoned. Use spatie/notifications or Laravel’s core instead.
    • Example migration:
      // Old
      Notifier::send($user, new OrderShipped());
      
      // New (Laravel 5.5+)
      $user->notify(new OrderShipped());
      
  2. No Queue Support:

    • Original package lacks Laravel’s queue system. Implement manually if needed.
  3. Channel Limitations:

    • Hypothetical: Channels like slack may not support webhooks or OAuth like modern packages.
  4. Configuration Overrides:

    • If config/notifier.php exists, ensure it doesn’t conflict with Laravel’s notifications.php.

Debugging

  • Channel Failures:
    • Check logs/laravel.log for ByscriptsNotifier\Exceptions (if any).
    • Modern alternative: Use NotificationFailed events.
  • Missing Classes:
    • The package may lack autoloading. Run composer dump-autoload if exploring.

Extension Points

  1. Custom Channels:

    • If reverse-engineering, extend ByscriptsNotifier\ChannelInterface (if defined).
    • Modern equivalent: Implement Illuminate\Contracts\Queue\ShouldQueue or Illuminate\Notifications\Notification.
  2. Event System:

    • Listen for notifier.* events (if implemented). Modern apps use Illuminate\Queue\Events\JobFailed.
  3. Fallback Logic:

    • Original package may have hardcoded fallbacks. Replace with Laravel’s fallback() method:
      $user->route('mail')->fallback(['mail' => 'backup@example.com']);
      

Pro Tips for Modern Replacement

  • Use spatie/notifications for:
    • Multi-channel support (e.g., Telegram, Discord).
    • Rate limiting.
  • Leverage Laravel’s notifiable trait:
    use Illuminate\Notifications\Notifiable;
    
  • Queue Notifications:
    $user->notify(new OrderShipped())->onQueue('notifications');
    

*(Note: All examples assume the package’s structure based on the name and era. Verify against actual code if exploring for legacy purposes.)*
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.
craftcms/url-validator
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony