5/14/2014 - 5:16 PM

CORT Setup

CORT Setup

Composer - PHP Package Manager

  • Creates a /vendor/ folder which autoloads all dependencies
  • Usually uses dependencies from GitHub, or some Git Host
  • Note: On Linux composer might be called with phar, but you can try: $ composer $ composer.phar
  • PHAR stands for PHP Archive. You do not need to know much else about it.




Once installed type $ composer

Create Composer File:

In the root of your application (The lowest level, the same area you see the /app folder in) create a file:

 $ touch composer.json

JSON means Javascript Object Notation. It sounds big, but's it's quite easy, and similar to arrays. This IS in fact, JavaScript syntax you would use in real javascript.


// Object examples: 
    {name: "ted"}

// Array example:
    [1, 2, 3];

// Object + Array example
        people: [

You may notice there are no variables assigned to the objects, this is because composer.json is a json file. In normal javascript you would do something like:

var obj = {nothing: "hello"};


This is where you can find all the packages for composer you'll ever need.

  • Look for "swiftmailer", it should have about 3 million downloads by it.
  • Click on the latest stable version (Not a dev or dev-master), but like v.5.2.0
  • Copy the line that says: "swiftmailer/swiftmailer": "v5.2.0" and paste into composer
  • Do the same with Mailgun.

For you to Solve:

Create your composer.json file, and require include those two packages. If you are stuck look at the packagist home page.

Install Packages

In terminal run (If you get errors, try to see whats wrong with your JSON file)

$ composer update 

You are going to have to include the /vendor/autoload.php file somewhere, I would ask Dan or Matt the best place to put it.

Now go to one of your controllers and see if the dependency is actually included and autoloading by creating the swift mailer object with something from their example code:


Reload your browser page where you put this in a controller, and if you get an error, it is not correct. It won't do anything, you just shouldn't get any errors.