3

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?
kelunik
  • 6,750
  • 2
  • 41
  • 70
nyluje
  • 3,573
  • 7
  • 37
  • 67

2 Answers2

4

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

Matteo
  • 37,680
  • 11
  • 100
  • 115
  • 1
    Thanks, it worked out also I had 'composer' in my environment variables, so just had to run: ">composer require amphp/thread". – nyluje Apr 12 '16 at 08:17
1

You will need to install the package by adding the following to your composer.json file:

"require": {
    "amphp/thread": "0.8.1"
}

Then run "composer install" on your server.

Mark Fox
  • 8,694
  • 9
  • 53
  • 75
LMS94
  • 1,016
  • 1
  • 7
  • 14
  • Thanks, I did use the 'composer require' as the other answer provided suggested, but it did result in what you described in the 'composer.json' file which is beneath the root folder of my project. – nyluje Apr 12 '16 at 08:20