Download the PHP package maba/mail-renderer-bundle without Composer

On this page you can find all versions of the php package maba/mail-renderer-bundle. 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 mail-renderer-bundle

Mail Renderer Bundle

Symfony bundle that collects some libraries together to make sending emails easier:

  1. Renders twig template to get subject and content of an email
  2. Converts HTML content to plain text if it's not available in template
  3. Sets default From email and name to message
  4. Gets CSS for mail messages using Assetic, if configured
  5. Inlines CSS inside HTML style attributes and/or adds <styles> tag
  6. Sends message using swift mailer

Installation

Add via composer:

composer require maba/mail-renderer-bundle jimbojsb/emogrify:@dev

Register bundle:

Configure in config.yml:

css_assets node is optional, as is usage of Assetic.

Usage

Code:

Twig template:

That's it!

All CSS rules assigned to classes will be inlined into HTML as style attributes.

Extended usage

Templates

Only these blocks are parsed from template: subject, body_html and body_text. subject and at least one of other two are required. Any other blocks or content in template is ignored.

If body_text is provided, it will be used as plain text version of mailer message.

Additionally toEmail variable is passed to the twig template, which equals to the given recipient.

I'd suggest to use single layout twig file, if there's defined structure in your mails. For example:

Styles

inline and imports values in css_assets configuration node take Assetic asset name, which you should configure using Assetic configuration.

inline is used when applying CSS rules to message HTML result - style attributes are added to HTML nodes, which would trigger appropriate CSS rules. This is needed as some email readers support neither <styles> nor <link> (for example GMail).

imports is used to make <styles> tag with CSS contents in the mail message itself. This should be as short as possible - usually only for rules that cannot be inlined, like this one:

That's why it's called imports in configuration.

Why <styles> instead of <link>? To avoid remote resource loading, which is also most commonly disabled by default.

Changing created message

Use createMessage instead of sendMessage with same parameters in renderer, change or add any required fields and send with swift mailer manually.


All versions of mail-renderer-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
symfony/framework-bundle Version ^2.3
twig/twig Version ~1.0
nickcernis/html-to-markdown Version ^2.2
jimbojsb/emogrify Version dev-master#5f323d2880e5df7de273c15e2a98e7c77a3cfba3
symfony/swiftmailer-bundle Version ^2.3
symfony/assetic-bundle Version ^2.6
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 maba/mail-renderer-bundle contains the following files

Loading the files please wait ....