youshido/mail
A Laravel package for handling mail, offering a simple way to integrate and manage email sending within your applications. Lightweight and easy to configure, it fits into existing Laravel projects without adding unnecessary complexity or overhead.
Read the room first: this is not a Laravel package. youshido/mail is a Symfony bundle (registered via AppKernel/bundles.php), so there is no service provider, no facade, no config/mail.php merge, and nothing that auto-discovers in Laravel. With a last release in April 2016, 1 star, and zero dependents, treat "getting started" as an archaeology exercise, not an install.
Minimal steps:
composer require youshido/mail in a throwaway Symfony 2.8/3.x sandbox — not in your production app. Check composer.json first: PHP constraint, autoload standard (PSR-0 vs PSR-4), and whether it pulls swiftmailer/swiftmailer (EOL since Nov 2021).MailBundle.php — bundle class, compiler passes.DependencyInjection/*Extension.php — the load() method is your config schema; every ->rootNode() child is a key you must supply or that has a default.Resources/config/services.* — service IDs and constructor args. This tells you what to inject and what it wraps.If you are in Laravel full-time, the realistic "first use case" is reading the mailer class to see how it renders a template into a message, then writing the 40-line Mailable + Blade view that does the same thing natively.
Anti-corruption wrapper (the main pattern). Never let the bundle's service leak into your controllers. Define your own App\Mail\Notifier interface (send(string $template, array $data, Recipient $to)), implement it once with the bundle's mailer, and inject the interface everywhere. Given the abandonment risk, this makes swapping to Symfony Mailer or Laravel's Mail a one-file change.
Inject, don't instantiate. The whole value of a bundle is DI. Constructor-inject the mailer service into your own services; keep controllers to a single call. If the service is not in the container, bin/console debug:container <id> immediately tells you the extension didn't load or a required config node is missing.
Template-per-message. Keep bodies in templates and pass a plain data array — no HTML string-building in PHP. Where the bundle expects templates (its own Resources/views vs app/Resources/views) is a config key; pin it explicitly rather than relying on the default.
Transport separation. If the bundle delegates to Symfony's Swift Mailer config (mailer_transport, mailer_host, …), keep environment-specific transport in parameters, and in tests use a spool/null transport so nothing leaves the machine. If the bundle does not expose the composed message, your wrapper should, or you cannot assert on subject/recipients/body.
Laravel translation pattern. Don't attempt to register a Symfony bundle in Laravel. Port the concept:
Mailable with a Blade/Markdown view.Mail::to($user)->send(new WelcomeMail($user)).ShouldQueue.Symfony 5+/6+ translation pattern. Replace the bundle service with Symfony\Component\Mailer\MailerInterface + Email/TemplatedEmail. Keep your Notifier wrapper so the call sites survive the swap.
Swift_Message to a transport will not run on Symfony 6+ (Swift Mailer was removed). This alone disqualifies it from a greenfield build.Templating component (templating.engine.*), $this->container in controllers/commands, or getContainer(). Templating was removed in Symfony 5.0, so those code paths fail before your first email is sent.InvalidConfigurationException at container compile time, not at send time. Read load() to know exactly which keys are mandatory.composer require succeeds but classes aren't found, check composer.json's autoload section and run composer dump-autoload -o.replace/path-repo over a floating constraint.bin/console debug:container --tag=... for registration → debug:config <alias> for the resolved config tree → spool transport to inspect the raw MIME → only then suspect the mailer class.send(template, data, recipient)) so the bundle is an implementation detail.Mail + Mailables (or Symfony Mailer/Notifier on Symfony); borrow only the templated-mailer idea from this repo's source.How can I help you explore Laravel packages today?