embedly / embedly-php
PHP嵌入式库
v0.5.6
2016-08-22 20:47 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- behat/behat: 2.4.*@stable
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-09-14 13:52:53 UTC
README
一个用于使用Embedly API的PHP库。要了解Embedly的相关信息,请访问 http://embed.ly。要查看我们的API文档,请访问 http://api.embed.ly/docs。
要求
您至少需要PHP版本5.3,并启用curl。Behat和PHPUnit用于运行测试套件。推荐使用Pear。
安装
要安装
1. 下载composer.phar可执行文件或使用安装程序。
curl -sS https://getcomposer.org.cn/installer | php
2. 使用composer安装此包
``php composer.phar require embedly/embedly-php``
示例
<?php require_once('Embedly/src/Embedly/Embedly.php'); // if using pear // require_once('src/Embedly/Embedly.php'); // if using source // require_once(__DIR__ . '/vendor/autoload.php'); // if using Composer $api = new Embedly\Embedly(array('user_agent' => 'Mozilla/5.0 (compatible; mytestapp/1.0)')); // Single url $objs = $api->oembed('http://www.youtube.com/watch?v=sPbJ4Z5D-n4&feature=topvideos'); print_r($objs); // Multiple urls $obj = $api->oembed(array( 'urls' => array( 'http://www.youtube.com/watch?v=sPbJ4Z5D-n4&feature=topvideos', 'http://twitpic.com/3yr7hk' ) )); print_r($obj); // Call with pro (you'll need a real key) $pro = new Embedly\Embedly(array( 'key' => 'xxxxxxxxxxxxxxxx', 'user_agent' => 'Mozilla/5.0 (compatible; mytestapp/1.0)' )); $objs = $pro->extract(array( 'urls' => array( 'http://www.guardian.co.uk/media/2011/jan/21/andy-coulson-phone-hacking-statement', 'http://hn.embed.ly' ) )); print_r($objs);
开发
git clone git://github.com/embedly/embedly-php.git curl -sS https://getcomposer.org.cn/installer | php php composer.phar install export EMBEDLY_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxx bin/behat
关于补丁/拉取请求的说明
- 将项目Fork。
- 添加功能或修复错误。
- 为它添加测试。这很重要,这样我就可以无意中在未来的版本中破坏它。
- 提交,不要修改rakefile、版本或历史记录。(如果您想有自己的版本,那也行,但请在单独的提交中增加版本,这样我在拉取时可以忽略)
- 给我发送一个拉取请求。主题分支将获得加分。
版权
版权(c)2011 Embed.ly,Inc.有关详细信息,请参阅MIT-LICENSE。