Search code examples
phpmultithreadingsymfonyamphp

PHP framework AMPHP/THREAD used with SYMFONY - Where does it have to be installed?


I am looking to implement the framework amphp/thread, with Symfony3, which I ve read about in this article (https://www.mullie.eu/parallel-processing-multi-tasking-php/).

I'd looked at the setting process on the git page: https://github.com/amphp/thread.

I've followed the checklist:

  • PHP5.5+ = OK Php 5.5.12
  • pecl/pthread = OK I did install it as explained on Windows8

Now, 3rd task on the checklist, I have the installation of the framework itself (amphp/thread) left to do.

I am a bit confuse, because it is not an "official" Symfony bundle. So I don't think I can put it under [my_symfony_project]/vendor/ and refer to it in the file [my_symfony_project]/app/AppKernel.php. So how do one do in this case:

  • Do one put the directory of the library under the root directory [my_symfony_project]?
  • And afterwards, how can one refer to it in the Symphony class/file, should I write: "use amphp/thread" between the namespace declaration of my Symfony file and the class code itself?

Solution

  • You can simply install the library with composer, as example launching this command from the root of your project:

    >php composer.phar require amphp/thread
    

    And use it in your code directly: the composer process generate the correct autoloader for you. No necessary add to the list of the Symfony2 bundle (is not a bundle).

    Hope this help