Skip to content

Notification Commands

Console commands for managing push notifications and device tokens.

List Device Tokens

List registered device tokens for push notifications.

bash
php bin/console app:device-tokens:list [options]

Options:

OptionDescription
--user-idFilter by user ID
--emailFilter by user email
--platformFilter by platform (ios/android)

Examples:

bash
# List all iOS device tokens
php bin/console app:device-tokens:list --platform=ios

# List tokens for specific user
php bin/console app:device-tokens:list --email=user@example.com

Send Device Notification

Send push notifications to user devices.

bash
php bin/console app:device-tokens:notify [options]

Options:

OptionDescription
--user-idUser ID to notify
--emailUser email to notify
--allNotify all registered devices
--platformLimit to platform (ios/android)
--titleNotification title (required)
--bodyNotification body (required)
--extraOptional extra data field value

Examples:

bash
# Send to specific user
php bin/console app:device-tokens:notify --user-id=1 --title="Hello" --body="Test notification"

# Send to all Android devices
php bin/console app:device-tokens:notify --all --platform=android --title="Update" --body="New version available"

Test Notification

Test push notification delivery to verify configuration.

bash
php bin/console app:notification:test --user=<identifier> [--platform=<platform>]

Options:

OptionDescription
--user, -uUser email or ID (required)
--platform, -pSpecific platform (ios/android)

Example:

bash
php bin/console app:notification:test --user=user@example.com --platform=ios

TIP

Use this command to verify your APNs (iOS) and FCM (Android) configuration is working correctly.

Warranty Notification Commands

Dispatch Warranty Notifications

Queue warranty expiration notifications for asynchronous processing.

bash
php bin/console app:dispatch-warranty-notifications

This command:

  1. Finds products with warranties expiring soon
  2. Creates notification jobs in the message queue
  3. Notifications are sent asynchronously by workers

Scheduling

This command should be run via cron job, typically daily:

bash
0 9 * * * cd /path/to/project && php bin/console app:dispatch-warranty-notifications

List Expiring Warranties

List products with warranties expiring within a specified window.

bash
php bin/console app:warranties:expiring [--days=<days>]

Options:

OptionDescription
--daysDays window from today (default: 30)

Example:

bash
# List warranties expiring in next 60 days
php bin/console app:warranties:expiring --days=60

List Notification Logs

View warranty notification logs to track what notifications were sent.

bash
php bin/console app:warranties:notifications:list [options]

Options:

OptionDescription
--product-idFilter by product ID
--daysFilter by threshold days
--limitLimit result count (default: 100)

Example:

bash
php bin/console app:warranties:notifications:list --product-id=123

Notification Thresholds

The system sends warranty expiration notifications at these thresholds:

  • 30 days before expiration
  • 7 days before expiration
  • 1 day before expiration

Each product only receives one notification per threshold (tracked in notification logs).

MyWarranties - Warranty Management System