Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/romac/rroembed
RRoEmbed is a PHP 5.3+ library which provides an object-oriented interface to consume oEmbed resources (ABANDONED)
https://github.com/romac/rroembed
Last synced: 8 days ago
JSON representation
RRoEmbed is a PHP 5.3+ library which provides an object-oriented interface to consume oEmbed resources (ABANDONED)
- Host: GitHub
- URL: https://github.com/romac/rroembed
- Owner: romac
- Created: 2010-05-30T22:46:26.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-12-20T16:29:24.000Z (almost 12 years ago)
- Last Synced: 2024-04-14T07:35:43.248Z (7 months ago)
- Language: PHP
- Homepage:
- Size: 687 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.mdown
Awesome Lists containing this project
README
RRoEmbed
========Description
-----------RRoEmbed is a PHP 5.3+ library that provides an interface to consume oEmbed resources.
oEmbed
------oEmbed is a format for allowing an embedded representation of a URL on third party sites.
The simple API allows a website to display embedded content (such as photos or videos)
when a user posts a link to that resource, without having to parse the resource directly.Read more: [oEmbed website](http://www.oembed.com/)
Usage
-----```php
register();// Create a new consumer.
$consumer = new RRoEmbed\Consumer();// Call the "consume" method and supply it the URL of the resource you'd like
// to get the oEmbed representation of and the Provider instance.
$resource = $consumer->consume(
'http://www.youtube.com/watch?v=ThvBJMzmSZI',
new RRoEmbed\Provider\YouTube()
);// Will call __toString()
print $resource;Result:
[…]// You can also omit to specify the provider, if so the Consumer will try to
// automatically find a valid provider endpoint.
// Note that, as the Consumer class implements the __invoke method you
// can use any of its instances as a callable.
$resource = $consumer( 'http://www.youtube.com/watch?v=ThvBJMzmSZI' );print_r( $resource );
Result:
RRoEmbed\Resource\Video Object
(
[_html:protected] => 480
[_height:protected] => 295
[_type:protected] => video
[_version:protected] => 1.0
[_title:protected] => The Most AMAZING video on the internet #Egypt #jan25
[_authorName:protected] => hadi15
[_authorUrl:protected] => http://www.youtube.com/user/hadi15
[_providerName:protected] => YouTube
[_providerUrl:protected] => http://www.youtube.com/
[_cacheAge:protected] => 0
[_thumbnailUrl:protected] => http://i1.ytimg.com/vi/ThvBJMzmSZI/hqdefault.jpg
[_thumbnailWidth:protected] => 480
[_thumbnailHeight:protected] => 360
)
```
License
-------
Copyright (c) 2012 Romain Ruetschi
Dual licensed under the [MIT](http://opensource.org/licenses/mit-license.html) and [GPL](http://www.gnu.org/licenses/gpl-2.0.html) licenses.