使用Ruby库在PHP应用程序 [英] Using Ruby library in PHP application

查看:91
本文介绍了使用Ruby库在PHP应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个PHP项目,利用美国职棒大联盟的比赛日数据的。似乎有一个pretty固体 Ruby库用于处理数据。我并不特别想重写PHP中的整个库,所以我想知道如果任何人有对与从我的PHP应用程序的Ruby脚本互动的好方法的任何建议。

I am working on a PHP project that makes use of MLB's Gameday data. There appears to be a pretty solid Ruby library for working with data. I don't particularly want to rewrite the entire library in PHP, so I was wondering if anyone had any suggestions for a good way to interact with the Ruby scripts from my PHP application.

我开始想,我需要编写一些命令行Ruby脚本的那会与Ruby类和输出的数据由PHP(JSON,XML)使用的格式进行交互。

I'm starting to think that I'll need to write some sort of command line Ruby script that'll interact with the Ruby classes and output the data in a format usable by PHP (JSON, XML).

是否有更好的方法来做到做到这一点?

Are there any better ways to do accomplish this?

推荐答案

另一种选择是使用 Gearman的,以书面形式在同一支球队给我们带来了memcached的。它有 PHP 并的红宝石绑定。

Another option is to use Gearman, written by the the same team that brought us memcached. It has PHP and Ruby bindings.

您会在Ruby中创建一个后台程序暴露功能Gearman的,然后让你的PHP code调用通过Gearman的那些功能。没有阿帕奇必要的。

You'd create a daemon in Ruby that exposes functions to Gearman, then have your PHP code call those functions through Gearman. No Apache needed.

(男孩,我在一个堵的Gearman连胜。我希望我得到报酬为它!)

(Boy, I'm on a Gearman plugging streak. I wish I was getting paid for it!)

这篇关于使用Ruby库在PHP应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆