emanueleminotto/embedly
Composer 安装命令:
composer require emanueleminotto/embedly
包简介
Library for embed.ly APIs
README 文档
README
Library for embed.ly APIs based on Guzzle 5.
API: emanueleminotto.github.io/Embedly
Install
Install the Embedly library adding emanueleminotto/embedly to your composer.json or from CLI:
$ composer require emanueleminotto/embedly
Read more about the Composer installation here: getcomposer.org/doc/00-intro.md
Usage
This library provides 3 API: embed.ly/docs/api.
Some APIs need an API key you can set in the constructor os using the setApiKey method.
The second method of the constructor can be a Guzzle HTTP client to use as an alternative of the default one.
Embed
Options are available at http://embed.ly/docs/api/embed/arguments
For this method the $api_key can be null.
use EmanueleMinotto\Embedly\Client; $client = new Client($api_key); $embed = $client->oembed([ 'url' => 'http://www.example.com/', ]); // enumerated array containing // arrays like $embed $embeds = $client->oembed([ 'urls' => [ 'http://www.example.com/', 'http://www.google.com/' ] ]);
Extract
Options are available at http://embed.ly/docs/api/embed/arguments
use EmanueleMinotto\Embedly\Client; $client = new Client($api_key); $extracted = $client->extract([ 'url' => 'http://www.example.com/', ]); // enumerated array containing // arrays like $extracted $extracteds = $client->oembed([ 'urls' => [ 'http://www.example.com/', 'http://www.google.com/' ] ]);
Display
The first argument can be NULL, crop, resize or fill.
Options are available at
- http://embed.ly/docs/api/display/endpoints/1/display
- http://embed.ly/docs/api/display/endpoints/1/display/crop
- http://embed.ly/docs/api/display/endpoints/1/display/resize
- http://embed.ly/docs/api/display/endpoints/1/display/fill
Currently the url attribute is required.
use EmanueleMinotto\Embedly\Client; $client = new Client($api_key); $content = $client->display('resize', [ 'url' => 'http://placehold.it/250x100', 'color' => '000', 'height' => 150, 'width' => 150, ]);
Twig Extension
In this library there's included a Twig extension to allow a simple integration with frameworks.
Functions prefix is: embedly_, arguments are the same of the methods above.
{{ embedly_oembed({url: 'http://www.example.com'}).title }} {# Example Domain #}
emanueleminotto/embedly 适用场景与选型建议
emanueleminotto/embedly 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.47k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「oembed」 「embedly」 「embed」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 emanueleminotto/embedly 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 emanueleminotto/embedly 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 emanueleminotto/embedly 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Embedly library for PHP
Bundle with a way of defining oEmbed providers, and rendering oEmbed in templates.
Get detailed info for any URL on the internet! Scraper for HTML, OpenGraph, Schema data
Embed laravel blade component + validation
PHP library to retrieve page info using oembed, opengraph, etc
Extracts information about medias on the web, like youtube videos, twitter statuses or blog articles.
统计信息
- 总下载量: 1.47k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 17
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-28