befuturein/scheduled-reminders

Flexible scheduled reminders package for Laravel.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/befuturein/scheduled-reminders

v0.1.1 2025-11-29 09:46 UTC

This package is auto-updated.

Last update: 2025-11-29 11:46:09 UTC


README

Tests Latest Stable Version Total Downloads License PHP Version

BeFuture Scheduled Reminders is a simple, extensible, and reliable scheduled reminder package for Laravel. It stores reminders in the database, processes them when their scheduled time arrives, and dispatches an event so you can send notifications through any channel (email, SMS, push, database, etc.).

Features

  • Create scheduled reminders easily
  • Automatically resolve due reminders
  • Prevent duplicate processing using is_sent flag
  • Fully event-driven architecture
  • Publishable config and migrations
  • UUID-based model
  • Service-based API
  • Console command for the scheduler
  • Complete Testbench integration
  • PSR-4 & SOLID compliant structure

Installation

composer require befuturein/scheduled-reminders

Laravel automatically discovers the service provider.

Publish Config & Migrations

Run these commands inside your Laravel application:

php artisan vendor:publish --tag=scheduled-reminders-config
php artisan vendor:publish --tag=scheduled-reminders-migrations
php artisan migrate

Configuration

config/scheduled-reminders.php:

return [
    'default_channel' => 'email',

    'channels' => [
        'email',
        'database',
        'sms',
    ],

    'run_interval_minutes' => 5,
];

Scheduler Setup

Add to your scheduler:

// app/Console/Kernel.php

protected function schedule(\Illuminate\Console\Scheduling\Schedule $schedule): void
{
    $schedule->command('scheduled-reminders:send')->everyMinute();
}

Usage (Service API)

Create a reminder

use BeFuture\ScheduledReminders\Services\ReminderService;

$reminder = app(ReminderService::class)->create([
    'title'        => 'Payment Reminder',
    'message'      => 'Please don’t forget your monthly payment.',
    'channel'      => 'email',
    'scheduled_at' => now()->addMinutes(10),
]);

Fetch due reminders

$due = app(ReminderService::class)->dueReminders();

Mark as sent

app(ReminderService::class)->markAsSent($reminder);

Event System

When a reminder is processed, this event is dispatched:

BeFuture\ScheduledReminders\Events\ReminderSent

Example listener:

class LogReminderSent
{
    public function handle(ReminderSent $event)
    {
        logger('Reminder sent', [
            'id' => $event->reminder->id,
        ]);
    }
}

Testing

This package includes full PHPUnit + Orchestra Testbench integration.

Run tests:

vendor/bin/phpunit

Example TestCase

abstract class TestCase extends BaseTestCase
{
    use RefreshDatabase;

    protected function getPackageProviders($app): array
    {
        return [
            ScheduledRemindersServiceProvider::class,
        ];
    }

    protected function defineDatabaseMigrations()
    {
        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
    }
}

Directory Structure

src/
    ScheduledRemindersServiceProvider.php
    Services/
    Models/
    Events/
    Console/

config/
database/
tests/
composer.json
phpunit.xml.dist
README.md

Architecture

  • Namespace: BeFuture\ScheduledReminders
  • Vendor: befuturein
  • Fully PSR-4 compliant
  • UUID-based primary keys
  • Service container bindings
  • Event-driven flow
  • Config-driven channel architecture
  • Extensible by design for email, SMS, push, queue systems, etc.

Development

composer install
vendor/bin/phpunit

License

MIT License.

About BeFuture Interactive

This package is part of the BeFuture Interactive open-source ecosystem. More packages coming soon.