Installation

Composer

The best (and currently only) way to install Ratchet is using composer. Simply add Ratchet by running this:

php ~/composer.phar require cboden/ratchet

Wait, What?

Unfamiliar with composer? Composer for PHP is the greatest thing since sliced bread.

Composer is an application written in PHP that will manage external PHP libraries within your project. Ratchet requires React, Guzzle, and Symfony2's HttpFoundation in order to work. It would be a pain in the butt to have to download Ratchet, then download those three libraries in order to make Ratchet work. Oh, and make sure you download the right versions or else there could be problems. But, you don't have to worry about that, thanks to Composer!

Find out how to install Composer in 1 easy step

Once you have composer.phar on your system (for this documentation, we're going to assume it's in your home directory) follow the instructions in the first section of this page.

You're now ready to start using Ratchet! Simply add the following line in the top of any PHP files to get Ratchet into your application:

<?php
    require __DIR__ . '/vendor/autoload.php';