Skip to content

LorenzoRizzolo/ParallelPhp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BotAPI Logo

Latest Version on Packagist PHP Version

🛠 Installation

You can install the package using composer:

composer require parallel/parallel

❔ Usage

After installation yoi can use this library using composer:

// require the autoload file of vendor to import the library
require_once __DIR__."/vendor/autoload.php";

// select the class in the name space parallel/parallel
use parallel\parallel\Thread;

// create the new object of Thread class
$thread = new Thread();

// create a function to esecute in background
function function_name(){  }

// you can pass an existing function as parameter or create a new function directly when you call the method start
$thread->start('function_name');
$thread->start(function(){  });

// if you use the method join it will wait the end of the new process created and then it will continue with the code.
$thread->join();

📝 Testing

There are few tests ready for use in test/ directory Try some examples:

# try from example_01 to 03
composer example_N

⚖️ License

This project is under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages