0
votes

Hi I'm creating project according to Tutorial on Ratchet website.

I installed zeromq version 0.3.0 through composer in phpstorm.(I checked if I installed right zeromq with phpinfo() and also with php-m in terminal)

In file post.php I cannot create new object of class ZMQContext(). - php storm cannot find this class. I found the same issue on stackoverflow but solution is for linux.I'm using win.

When I want to use this in code: use React\ZMQ. - I don't see there class ZMQContext

Thanks for answer.

2
ZeroMQ is not React/ZeroMQ, the latter builds on the former though. Also, can you create a minimal example? Without that, it's mere guessing. - Ulrich Eckhardt
I'm little bit confused. I bind zeromq with php according to site zeromq.org and then add dependency (through composer) -React/zmq. When I want create new object like $conn=ZMQContext(); It's cannot be find. What is missing ? - spruser
Check if the zeromq module is loaded at all. Also, do provide a minimal example, including the used composer.json so people have a chance to actually reproduce what you do. Paraphrasing code is not useful here. - Ulrich Eckhardt

2 Answers

1
votes

You can get PHPStorm to auto-complete code that uses the ZMQ PHP extension.

Save this stub file: https://gist.github.com/Mikulas/c22e44a918c7af5de5e6

I saved it (on OSX) under /Applications/PhpStorm EAP.app/Contents/plugins/php/lib/extensions/zmq.php

Then go to PHPStorm > Preferences > Languages & Frameworks > PHP > include path and add that extensions folder.

Now go back to your file and you'll see PHPStorm auto-completing stuff from the ZMQ extension.

Have fun! I hope you'll find this useful.

0
votes

It looks like you've installed the PHP PECL extension. You also need to install the ZeroMQ library on your system that ext-zmq will use. If you're an a Debian based system try sudo apt-get install libzmq-dev or a RH based system sudo yum install zeromq zeromq-devel.