Download the PHP package oligriffiths/emails-component without Composer

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

Nooku emails component

The idea behind this component is very simple, standardise sending templated emails through Nooku.

At present, all email sending is handled within each component manually. This offers no opportunity to brand the outgoing emails, or do any kind of data merging. This component handles both.

1. Sending emails

First step is to instantiate the email dispatcher

$config is optional, some defaults are pulled from the application /config/bootstrapper.php. The defaults are:

* template'         => 'default',               //the "wrapping" template to use
* layout'           => 'default',               //the "layout" to use if loading an email layout from the filesystem
* content'          => null,                    //email content
* content_txt       => null,                    //custom txt email content
* content_html      => null,                    //custom html email content
* from_email        => bootstrapper->mailfrom,
* from_name         => bootstrapper->fromname,
* mailer            => bootstrapper->mailer,    //one of smtp/sendmail/mail
* sendmail          => bootstrapper->sendmail,  //sendmail location
* smtp_auth         => bootstrapper->smtpauth,
* smtp_user         => bootstrapper->smtpuser,
* smtp_pass         => bootstrapper->smtppass,
* smtp_host         => bootstrapper->smtphost,
* smtp_port         => bootstrapper->smtpport,
* smtp_security     => bootstrapper->smtpsecure

All can be overridden when instantiating the object and passed as the second parameter $config as an array.

Once instantiated, send an email is pretty straight forward:

The absolute minimum params, are recipeient_email and subject and either content or layout, however there are other parameters you may wish to supply. The full list is below, most are self explainatory:

* from_email
* from_name
* recipient_email
* recipient_name
* recipients        //array of recipients, keys being email address, value being name
* subject
* content           //email content
* content_txt       //custom txt email content
* content_html      //custom html email content
* layout            //an email layout to load from the file system, specifiy EITHER content OR layout

The return value from send() is a boolean that indicates if the email sent successfully.

2. Body copy

Body copy for the email can be supplied in 2 ways, as either a layout template or as a string.

Layout template

This is the recommended approach. You can create email layouts on the filesystem and reference these when sending the email. Email layout templates must be placed within your active site template as template overrides, e.g. /applications/site/public/theme/themename/templates/emails/email/{name}.{format}.php

Support will be added in the future to load these templates from within another component so email templates can be bundled with a component.

String template

Pass the email content as a string, either content_html / content_txt or just content.

content_html and content_txt will define specific content for html and txt emails, content will use the same content for both, and will have nl2br() run on the html version.

3. Mail merge

The component will automatically mail merge any keys passed to the send() along with the defaults listed above method within the email body.

The format for mail merging is {{VARIABLE}}, in uppercase, e.g. {{FROM_EMAIL}}.

4. Transport mechanisms

This component uses SwiftMailer internally, and has 3 main supported transport mechanisms:

5. Anything else

Stick to the code, dig in an look at the code!

Pull request welcome

Twitter: @oligriffiths


All versions of emails-component with dependencies

PHP Build Version
Package Version
Requires nooku/installer Version dev-develop
swiftmailer/swiftmailer Version 5.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 oligriffiths/emails-component contains the following files

Loading the files please wait ....