Check out the CourseFREE Udemy course when you sign up this month
The examples on this site are currently tested to work on Phalcon V3.4 and Phalcon Devtools V3.2 Some issues may arise when using later versions.

Please get in touch or post a comment below the post if you encounter a problem.

Swiftmailer is a library of PHP objects which allow users to quickly and easily send emails from applications using a variety of different email services and transports.

Swiftmailer is hosted on the website which acts as the main repository from which composer installs components.

To install composer type the following in your project folder in the CLI

php composer.phar require swiftmailer/swiftmailer @stable

@stable will specify the latest stable release. If a specific version of a package is required the version number would go in place of @stable

Swiftmailer (and any other packages on which it depends) is now installed. Composer has created a new folder called "vendor" in the project folder where all composer packages will be installed. Within the vendor folder is a file called autoload.php. Once this file is "required" or "included" into any PHP application all the packages which have been installed with composer will be available to that application. Given this all that remains is to ensure that this file is "required". To to this edit app/config/loader.php - add the following line to the bottom of the file

require_once __DIR__ . "/../../vendor/autoload.php";

You can now use the Swiftmailer library to send emails from within your application. In the next post I'll show you how to do this.