The best (and currently only) way to install Ratchet is using composer. Simply add Ratchet by running this:
php ~/composer.phar require cboden/ratchet
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)
create a file called
composer.json in your project folder.
Inside that file copy and paste the JSON from the top of this page.
Next, type the following command to install Ratchet into your project. It will take about a minute to download all the files.
php ~/composer.phar install
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';