PHP code example of bouiboui / spawn

1. Go to this page and download the library: Download bouiboui/spawn library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bouiboui / spawn example snippets

bash
[Spawn] Starting 3 process(es)
 1/3 [=========>------------------]  33% ('php' 'send_updates.php' 'data/client1.json') 4 secs/12 secs 1.2 MiB
 2/3 [==================>---------]  66% ('php' 'send_updates.php' 'data/client2.json') 9 secs/14 secs 1.2 MiB
 3/3 [============================] 100% ('php' 'send_updates.php' 'data/client3.json') 14 secs/14 secs 1.2 MiB
 bash
./spawn.phar php send_latest_invoices.php startdate=2016-01-01

[Spawn] Starting 1 process(es)
 1/1 [============================] 100% ('php' 'send_latest_invoices.php' 'startdate=2016-01-01') 13 secs/13 secs 1.2 MiB
 bash
./spawn.phar php convert_pdfs.php document{1-42}.pdf

[Spawn] Starting 42 process(es)
  4/42 [==>-------------------------]   9% ('php' 'convert_pdfs.php' 'document4.pdf') < 1 sec/< 1 sec 1.2 MiB
  8/42 [=====>----------------------]  19% ('php' 'convert_pdfs.php' 'document8.pdf')  1 sec/5 secs 1.2 MiB
 12/42 [========>-------------------]  28% ('php' 'convert_pdfs.php' 'document12.pdf') 2 secs/7 secs 1.2 MiB
 16/42 [==========>-----------------]  38% ('php' 'convert_pdfs.php' 'document16.pdf') 3 secs/8 secs 1.2 MiB
 20/42 [=============>--------------]  47% ('php' 'convert_pdfs.php' 'document20.pdf') 4 secs/8 secs 1.2 MiB
 24/42 [================>-----------]  57% ('php' 'convert_pdfs.php' 'document24.pdf') 5 secs/9 secs 1.2 MiB
 28/42 [==================>---------]  66% ('php' 'convert_pdfs.php' 'document28.pdf') 6 secs/9 secs 1.2 MiB
 32/42 [=====================>------]  76% ('php' 'convert_pdfs.php' 'document32.pdf') 6 secs/8 secs 1.2 MiB
 36/42 [========================>---]  85% ('php' 'convert_pdfs.php' 'document36.pdf') 7 secs/8 secs 1.2 MiB
 40/42 [==========================>-]  95% ('php' 'convert_pdfs.php' 'document40.pdf') 8 secs/8 secs 1.2 MiB
 42/42 [============================] 100% ('php' 'convert_pdfs.php' 'document42.pdf') 9 secs/9 secs 1.2 MiB

 bash
./spawn.phar php get_gravatar.php data/users --find=*.json

[Spawn] Starting 3 process(es)
 1/3 [=========>------------------]  33% ('php' 'get_gravatar.php' 'data/users/martin-fowler.json') 4 secs/12 secs 1.2 MiB
 2/3 [==================>---------]  66% ('php' 'get_gravatar.php' 'data/users/rasmus-lerdorf.json') 5 secs/8 secs 1.2 MiB
 3/3 [============================] 100% ('php' 'get_gravatar.php' 'data/users/aaron-saray.json') 9 secs/9 secs 1.2 MiB
 bash
./spawn.phar php get_twitter_handle.php data/users --outfile=handles.txt

# handles.txt
$ php get_twitter_handle.php "data/users/martin-fowler.json"
@martinfowler

$ php get_twitter_handle.php "data/users/rasmus-lerdorf.json"
@rasmus

$ php get_twitter_handle.php "data/users/aaron-saray.json"
@aaronsaray