Search code examples
phplaravel-5reactphp

How to include a module in Laravel


I am trying to use ReactPHP in a Laravel 5.5 installation. In a non-laravel project it works fine. I've copied this library to

DOCUMENT_ROOT/vendor/react

The class I'm trying to load is DOCUMENT_ROOT/vendor/react/event-loop/src/Factory.php

I am using absolute referencing rather than using name-spaces - so in my class that uses React I have:

$loop = \React\EventLoop\Factory::create();

Laravel is complaining with:

Class 'React\EventLoop\Factory' not found

How can I get it to load, and is the vendor directory the right place to put it?


Solution

  • Try to use this laravel-wrapper (in laravel environemnt is important to use composer package manager to "manipulate" vendor directory)

    Composer is solution for so called dependency hell problem - everybody who have more experience and wider perspective appreciate this tool.