How do I create a thread?

Unlike Green Thread, this is actually literal threading.

Just like pthreads, the method to create a thread is quite simple.

use vennv\vapm\Thread;

class TestThread extends Thread {

	public function onRun() : void {
		//TODO: your logic
	}
}

To run a thread, do the following:

$class = new TestThread();
$class->start();

Last updated