php - Call python gearman worker using laravel 5 -
i using laravel 5. need call python gearman worker.
i have created gearman worker in python. , have created gearman client in laravel 5.
i have directly added gearman client code in controller like:
$client = new gearmanclient(); $client->addserver(); $job_data = array("func_name" => "searchtweets", "query" => "query_to_search"); $result = $client->donormal("php_twitter_worker", json_decode($job_data)); if ($result) { print_r($result); }
but throws error :
class 'app\http\controllers\gearmanclient' not found
i know error because don't have gearmanclient class in controllers. don't know how use it.
after doing r&d , found package using gearman in laravel5 not getting how use gearman client , how make call python gearman worker.
any on ?
because class namespaced, controller there, php class inside of namespace.
therefore, use class root namespace, should either use use statement or prefix classname \, \ being root namespace.
use gearmanclient; $client = new \gearmanclient();
use 1 or other, not both, code above quite confusing...
Comments
Post a Comment