Download the PHP package ryanstubbs/flightmail without Composer

On this page you can find all versions of the php package ryanstubbs/flightmail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package flightmail

FlightMail

CI Packagist Version Packagist Downloads

Send email from your Flight PHP app without the headaches.

FlightMail is a small plugin that wraps Symfony Mailer - the most battle-tested mail library in PHP - and makes it feel like part of Flight. One line to install, one fluent chain to send:

Why you'll like it:


Requirements

What Version
PHP 8.2 or newer
Flight PHP core ^3.15
Symfony Mailer ^7.2 or ^8.0 (installed automatically)

Installation

That's it for sending plain-text and HTML emails. Everything else is opt-in - add an engine only if you'll use it:

All of these can be installed side by side; FlightMail picks the right one based on what you configure.

Your first email

Add this to your bootstrap (the same place you define routes):

Using the Flight PHP skeleton instead? Register in app/config/services.php with the instance style:

Both styles expose the same mailer: Flight::mail() and $app->mail() are interchangeable.

Testing locally? If your project runs in DDEV, point the DSN at smtp://127.0.0.1:1025 and read every captured email in Mailpit at http://<project>.ddev.site:8025. Nothing leaves your machine.

Sending email

Plain strings (no template engine needed)

->text() and ->html() take raw strings and need nothing else installed:

Twig templates

Latte templates

Same idea, .latte extension:

HTML + plain text together

Best practice for deliverability - give mail clients both versions:

A few things worth knowing about templates:

Styling HTML and generating text parts

Two optional send-time enhancements, both off by default and both powered by libraries you only install if you want them:

Feature Install Config key
CSS inlining pelago/emogrifier inline_css
Text part from HTML league/html-to-markdown text_from_html

Inline CSS into your HTML email

Gmail and most webmail clients strip <style> blocks - inline style="" attributes are the only styling they reliably honor. Writing those by hand is miserable; let Emogrifier do it at send time:

With that on, every HTML body gets its CSS inlined just before sending - whether it came from a template or ->html(). A message like <style>p { color: red; }</style><p>Hi</p> goes out as <p style="color: red;">Hi</p>.

To also inject shared styles into every email (brand colors, resets) without repeating them in each template, pass rules directly or point at a stylesheet file:

Full documents keep their structure; fragments stay fragments. Per-message control:

Generate the text part from your HTML

Best practice is to send an HTML and a plain-text version together, but writing both is tedious. FlightMail can derive the text part from the final HTML automatically - no extra dependency required for basic conversion, since the converter ships with Symfony Mime:

Modes:

Generation runs after rendering and CSS inlining, and only when the message has an HTML body but no text body - an explicit ->text() or ->textTemplate() always wins. Per-message control mirrors inlining:

If you enable a mode whose library isn't installed, you get a clear error telling you exactly which composer require to run - never silent degradation.

Choosing a provider

Providers plug in through DSN strings. Install the bridge package, paste the DSN into dsns, done.

Provider Install DSN example
SMTP built-in smtp://user:pass@host:587
Sendmail built-in sendmail://default
Dev/null (drop mail) built-in null://null
Postmark composer require symfony/postmark-mailer postmark+api://[email protected]
Sendgrid composer require symfony/sendgrid-mailer sendgrid+api://KEY@default
Mailgun composer require symfony/mailgun-mailer mailgun+https://KEY:[email protected]
Amazon SES composer require symfony/amazon-mailer ses+https://KEY:SECRET@default
Brevo composer require symfony/brevo-mailer brevo+api://KEY@default
MailerSend composer require symfony/mailersend-mailer mailersend+api://KEY@default

The full list lives in the Symfony Mailer docs - anything documented there works here unchanged.

Multiple providers at once

Name each transport, then choose per message:

Configuration reference

Everything is optional except dsns.

Going further

Everything below is optional. The defaults cover most apps.

Add a custom DSN scheme

Implement Symfony's TransportFactoryInterface and register it - then your own scheme works exactly like a built-in one:

Add a custom template renderer

Anything that turns a template name plus params into a string qualifies:

Run something right before sending

Hooks receive the finished message - after rendering, after defaults, just before the wire:

Events and logging

Hand over a Symfony event dispatcher and/or PSR-3 logger and every transport will use them:

API cheat sheet

Since Message extends Symfony\Component\Mime\Email, every Symfony method you already know - attach(), embed(), priority(), replyTo() - works out of the box.

Troubleshooting

"No mail DSNs configured" You called Flight::mail() before registering the plugin, or the config array didn't include dsns. This error is deliberate - FlightMail refuses to guess where your mail should go rather than silently dropping it.

"Unknown mail template renderer ..." You used a template whose engine isn't installed. Fix with composer require twig/twig or composer require latte/latte, or register a custom renderer named after the extension.

"Unknown mail transport ..." A ->transport('name') (or default_transport) doesn't match any key in dsns. Check spelling - the error lists the configured names.

"CSS inlining requires pelago/emogrifier" You enabled inline_css (or called ->inlineCss()) without installing the library. Fix with composer require pelago/emogrifier.

"Markdown text parts require league/html-to-markdown" You forced text_from_html to 'markdown' (or ->textFromHtml('markdown')) without the library installed. Fix with composer require league/html-to-markdown, or use true/'auto'/'plain', which degrade gracefully.

Mail isn't arriving Point dsns at null://null to confirm the rest of your code works, then switch back to the real DSN. In DDEV, use smtp://127.0.0.1:1025 and inspect messages in Mailpit at port 8025.

Development

This repository is a DDEV project:

Contributing & license

Bug reports and pull requests welcome. MIT licensed - see LICENSE.


All versions of flightmail with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
flightphp/core Version ^3.15
symfony/event-dispatcher Version ^6.4 || ^7.2 || ^8.0
symfony/http-client-contracts Version ^3.2
symfony/mailer Version ^7.2 || ^8.0
symfony/mime Version ^7.2 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ryanstubbs/flightmail contains the following files

Loading the files please wait ...