在php框架中使用node js

在php框架中使用node js

问题描述:

I'm currently using the silex micro-framework on my project and recently discovered node js to include socket.io to my project. My question is, how can i use both of those technologies in my project ?

I found a few answers on the web but nothing good and I'm sure it's no big deal.

Someone to help me ?

我目前正在我的项目中使用silex微框架,最近发现节点js包含socket.io到 我的项目。 我的问题是,我如何在我的项目中使用这两种技术? p>

我在网上找到了一些答案,但没什么好处的,我确定它不大 交易。 p>

有人帮助我吗? p> div>

You could use Gearman. docs is here

Code a "worker" in node and add jobs for that worker in php.

I understand my answer is not detailed as to how to code the Gearman worker and how to add jobs to the Gearman job Queue. But this is a way that will work. We do that where I work to offload the validation of huge chunks of JSON against a JSON schema. The app is in php but node.js is probably 100x faster than php to validate JSON against a schema...so we have best of both worlds :)

Basically, read Gearman's documentation and you will be able to do what you want to do.