create custom class that extend thread in yii2 create custom class that extend thread in yii2 multithreading multithreading

create custom class that extend thread in yii2


Extends Something means that class Something searched in current namespace. \Something means that class searched in root namespace. See basics of namespaces.

You don't have class common\components\Thread in your common\components namespace. In your case use class AsyncOperation extends \Thread {


Someone already gave you the answer you were looking for ... however ...

I notice you have markup in your thread, and are using a web framework.

I'm going to assume you are creating threads at the frontend of your web application, inside a web server: This is a terrible idea.

The latest releases of pthreads prohibit execution inside a web server, you are going to need to do things differently if you want to use PHP7 and pthreads, which is soon to be the only supported way to use pthreads.