PHP pthreads with Laravel DB Connection with ORM queries
<p>My existing Laravel project is such that all the tasks are executed sequentially. I have identified part of the code which can be run in parallel using PHP threads and can reduce the response time. </p>

<p>So I'm trying to use pthreads, <a href="https://github.com/krakjoe/pthreads/tree/PHP5" rel="nofollow">https://github.com/krakjoe/pthreads/tree/PHP5</a>. The appserver.io is already comes with pthread, thus I'm running project on appserver.io and not apache.</p>

<p>I was able to use pthread successfully. As in creating new PDO connection under <code>run()</code> method for each thread and database interaction is working fine using native query like this:</p>

<pre><code>self::$connection = new PDO ( 'mysql:host=127.0.0.1;dbname=mydb' , 'myuser' , 'mypass' );
</code></pre>

<p>But I'm not able to use Laravel's <code>\DB:connection</code> the same way. I need to have this working in order to run my code which is written with ORM based queries. How can I create new connection every time under <code>run()</code> method?</p>