Weave 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

Symfony Fake Sms Notifier Laravel Package

yieldstudio/symfony-fake-sms-notifier

A Symfony notifier transport that fakes SMS delivery for testing and local development, letting you intercept outgoing messages without hitting real providers. Ideal for asserting notifications in functional tests and keeping dev environments safe.

View on GitHub
Deep Wiki
Context7

Getting Started

This is a Symfony Notifier bridge, not a Laravel package. In a Laravel app, treat it as a dev/test utility for intercepting outbound SMS instead of hitting a real gateway.

  1. Install via Composer:
    composer require --dev yieldstudio/symfony-fake-sms-notifier
    
  2. Ensure the Symfony Notifier component is available:
    composer require symfony/notifier
    
  3. Configure a notifier transport using the fake SMS DSN (typically fake-sms:// or the transport name exposed by the package — confirm the exact DSN in the package README).
  4. First use case: in a feature test or local environment, send an SMS through Symfony\Component\Notifier\Notifier and assert that the fake transport captured it rather than sending a real message.

Look first at the package’s transport class and any test helpers it exposes. Those tell you how to retrieve captured messages and reset state between tests.

Implementation Patterns

  • Local environment guard: Register the fake transport only in local and testing environments. In Laravel, conditionally bind the Symfony Notifier service in a service provider based on app()->environment().
  • Feature test assertions: Send an SMS through the Symfony Notifier, then inspect the fake transport’s stored messages. Wrap this in a small helper or assertion to keep tests readable.
  • Service container binding: Because Laravel does not natively use Symfony Notifier transports, build a small Notifier instance with the fake transport and bind it as a singleton. This avoids constructing the transport repeatedly.
  • Reset between tests: Clear captured messages in setUp or via a RefreshDatabase-style trait so tests don’t leak state.
  • Bridge to Laravel notifications: If your app uses Laravel’s notification system, create a custom notification channel that delegates to the Symfony Notifier when the fake transport is active. This keeps production code on Laravel conventions while still allowing captured SMS in tests.
  • Manual inspection during local development: Add a temporary route or artisan command that dumps captured fake SMS messages, or log them. This is useful when testing multi-step flows that trigger SMS.

Gotchas and Tips

  • Not a Laravel package: There is no Laravel service provider or facade. Expect to wire it manually.
  • PHP 8 support arrived in 1.0.1: The 1.0.0 release targeted older PHP versions. If you are on PHP 8, use 1.0.1 or later.
  • Symfony Notifier version alignment: Check the package’s Composer constraints against your Symfony Notifier version. A mismatch can cause transport interface errors.
  • No real delivery: This transport does not send SMS. Do not register it in production or you will silently drop messages.
  • DSN confusion: The fake transport’s DSN may not be obvious. Consult the package source or README; if no DSN is documented, instantiate the transport class directly.
  • State persistence: Captured messages may live on the transport instance. If you bind a new transport per request, you lose messages between requests. For HTTP tests, bind a singleton or inspect within the same request lifecycle.
  • Debugging: If nothing is captured, verify that the notifier is actually using the fake transport — not a real one. Dump the transport class from the container.
  • Extension point: Wrap the fake transport in your own decorator if you need to forward captured messages to logs, mail, or a test assertion library.
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.
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus