Download the PHP package monomelodies/emily without Composer

On this page you can find all versions of the php package monomelodies/emily. 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 emily

Emily

Twig and Symfony Mailer-based HTML emails

Emily is an extension to Symfony Mailer adding support for the following:

Usage

Define an Monomelodies\Emily\Message and setup a Twig template:

(See Swift documentation for details on how to send messages using a Swift_Transport of your choice.)

Templates and variables

In your template, you can define a number of Twig "blocks" for the various parts of your message:

You can also use regular Twig variables:

...which you define using the Emily\Message::setVariables method:

Variables can be used in any block, including the subject.

Of course, you can also let your messages extend a more global template using normal Twig extending rules. Templates can also define other blocks (e.g. some kind of sidebar in your template with the latest news posts at the moment of sending - use your imagination here). Depending on your Twig_Environment, you might also use translations etc.

Setting the recipient, adding attachments etc.

The return value of Monomelodies\Emily\Message::get is simply a Symfony\Component\Mime\Email (with all variables replaced), so you can do what you want with it. Note that after any variable change, you'll need to re-call get to receive an updated version.

Testing emails

Of course, you could just write a scripts that constantly mails your test mails to your own email address, but that's a bit tiresome. An easier way - at least for initial development, eventually you'll want to test mails in actual clients

Initialise the object with your Monomelodies\Emily\Message object as its parameter. Then, call the render method to display a simple HTML page to develop your mails in.

We mean a full HTML page, so that includes <head> andsoforth. Either load this in a separate PHP file or instruct your router or front controller or whatever you use not to wrap it in any template.

Enter the name of the template to test (this should be resolvable by the Twig loader in your Message object) and optionally a JSON-encoded string of variables to inject. Click "submit". Awesomeness! Now during testing just reload the page whenever you've changed something and see how it works out.

Inlining CSS

For best results, HTML mails should use inline CSS, not an external or embedded stylesheet. The Message constructor accepts a string of CSS to be inlined. This means you can use classnames and IDs and whatnot in your mail templates, as if you're building an actual webpage. This is highly useful, since normally your fancy mails will want to somewhat mimick the accompanying website's appearance!


All versions of emily with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
twig/twig Version ^2|^3
tijsverkoyen/css-to-inline-styles Version ^2.2
symfony/mailer Version ^6.1
symfony/mime Version ^6.2
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 monomelodies/emily contains the following files

Loading the files please wait ....