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

Laravel Snip Laravel Package

rudolfbruder/laravel-snip

Laravel Snip is a lightweight package for creating and managing reusable snippets in Laravel applications. It provides a simple API and Blade-friendly rendering so you can store, organize, and reuse content with minimal setup. Quick to install and easy to extend.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install the package per its docs, then publish its assets: php artisan vendor:publish --tag=snip-assets. After upgrading, re-run with --force.
  • In .env, set SNIP_MAIL_CATCH=true (recommended as of v0.3.6). This replaces the older MAIL_MAILER=snip approach for most apps.
  • Restart long-running workers after changing the env: php artisan queue:restart (or php artisan horizon:terminate for Horizon).
  • Open the package playground and go to the Mail tab → Inbox. Send a mail from Tinker, a local route, or a test command; it should appear in the inbox instead of being delivered.
  • First use case: debug transactional mail locally—recipients, subject, HTML/text rendering, headers—without configuring SMTP or risking real sends.

Implementation Patterns

  • Use the catch-all switch for multi-mailer apps. If your app selects mailers per message (e.g. Mail::mailer('shop_sk')->to(...)->send(...)), SNIP_MAIL_CATCH=true catches those too. Do not rely on setting each mailer to snip.
  • Keep the env local-only. Add SNIP_MAIL_CATCH=true to your local .env/.env.local and keep it unset or false in shared/staging/production environments.
  • Queue workflow: after toggling the env, restart workers so they pick it up. Use the playground’s “catch a new mail the way a queue worker would” button to verify queued mailables are captured as a worker would see them—useful when debugging serialization, after deploy, or when the inbox is unexpectedly empty.
  • Template iteration: send the same mailable repeatedly and refresh the Mail tab’s Inbox to inspect rendered output. This is faster than round-tripping through an external SMTP catcher for small Blade changes.
  • Upgrade workflow: update the package, republish assets with --force, clear cached config if needed (php artisan config:clear), restart workers, then confirm the Mail tab shows the new inbox/setup guidance.

Gotchas and Tips

  • MAIL_MAILER=snip only caught mail sent through the default mailer. Per-mail Mail::mailer('...') calls bypassed it and still sent. Switch to SNIP_MAIL_CATCH=true if you use multiple mailers.
  • Long-running queue workers will not see a changed SNIP_MAIL_CATCH until restarted. The empty inbox reminder in v0.3.6 is specifically pointing at this.
  • vendor:publish --tag=snip-assets --force overwrites published assets. If you customized playground views/assets, diff or back them up before forcing.
  • If mail still sends locally, check in order: env value is actually loaded, config cache cleared, queue worker/Horizon restarted, and the package’s docs for any mailer/transport limitations.
  • Keep the playground inaccessible outside local/dev. Review the published config/assets for route and middleware settings, and gate it behind local environment checks or auth as needed.
  • Republish assets after every package update; stale assets can hide new Mail tab controls or the queue-worker simulation button.
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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle