Schedule Syncing Automatically
If you want the disposable domain list to stay updated without running the sync command manually, you can schedule it in Laravel.
1. Open routes/console.php
Add your scheduled command where your Laravel console schedule is defined.
2. Add the sync command
use Illuminate\Support\Facades\Schedule;
Schedule::command('erag:sync-disposable-email-list')->daily();3. Choose the schedule you want
You are not limited to daily(). You can choose whatever timing fits your application.
Examples:
Schedule::command('erag:sync-disposable-email-list')->hourly();
Schedule::command('erag:sync-disposable-email-list')->daily();
Schedule::command('erag:sync-disposable-email-list')->weekly();4. Make sure Laravel scheduling is running
Your server or local environment still needs Laravel's scheduler to run normally.
If Laravel scheduling is not running, the sync command will never execute automatically.
5. When this is useful
Automatic syncing is useful when:
- you want fresh disposable domains without manual updates
- your app depends on current domain data
- you do not want to rely only on package version updates
6. Update the built-in package array daily
The package repository also includes a maintainer script that updates the built-in Email::domains() array from:
https://raw.githubusercontent.com/eramitgupta/disposable-email/main/disposable_email.txtRun it from the package root:
php scripts/update-built-in-domains.phpThe script:
- fetches the remote domain list
- normalizes email-style entries to domains
- removes invalid lines
- deduplicates and sorts domains
- rewrites
src/Support/Email.php
This is for maintaining the package source array. For Laravel applications, use php artisan erag:sync-disposable-email-list to sync domains into storage.
7. GitHub Actions daily update
The repository includes a daily workflow:
.github/workflows/update-built-in-domains.ymlIt runs every day at 02:00 UTC, updates src/Support/Email.php, and commits only when the built-in domain array changes.