-
Hello 👋 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, I'm not sure what you are trying to do, for me you want two instaciate the <?php
require_once 'vendor/autoload.php';
// First instance
$pu1 = new \Nesk\Puphpeteer\Puppeteer;
$br1 = $pu1->launch(['headless' => false]);
// Second instance
$pu2 = new \Nesk\Puphpeteer\Puppeteer;
$br2 = $pu2->launch(['headless' => false]);
echo shell_exec('ps | grep node');
sleep(10); Try it, you should see the following output:
We can see we have two node processes running at the same time. Also you should see two browsers opened on your OS (due to |
Beta Was this translation helpful? Give feedback.
-
@nesk I wanted to open another issue for this, but seemed a bit related, and it was also a question not an issue, so. What do you think is the best approach performance-wise, if you're using phphpeteer to generate pdf exports? Isn't it better if we keep a node process running and just use that? Or should we boot a process and close it with each export? |
Beta Was this translation helpful? Give feedback.
Hi,
I'm not sure what you are trying to do, for me you want two instaciate the
Nesk\Puphpeteer\Puppeteer
class multiple times? This is perfectly possible and it works out of the box, check out this script:Try it, you should see the following output: