Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Enable syntax highlighting.

  • Loading branch information...
commit a1dd6e69d8fd746cb70a4fdb2808f3908cdd2382 1 parent 8d45d04
Romain Ruetschi authored December 20, 2012

Showing 1 changed file with 56 additions and 55 deletions. Show diff stats Hide diff stats

  1. 111  README.mdown
111  README.mdown
Source Rendered
@@ -4,7 +4,7 @@ RRoEmbed
4 4
 Description
5 5
 -----------
6 6
 
7  
-RRoEmbed is a PHP 5 library which provides an interface to consume oEmbed resources.
  7
+RRoEmbed is a PHP 5.3+ library that provides an interface to consume oEmbed resources.
8 8
 
9 9
 oEmbed
10 10
 ------
@@ -18,60 +18,61 @@ Read more: [oEmbed website](http://www.oembed.com/)
18 18
 Usage
19 19
 -----
20 20
 
21  
-    <?php
22  
-
23  
-    // Include the autoloader.
24  
-    require_once( __DIR__ . '/Classes/Autoloader.class.php' );
25  
-
26  
-    // Register the autoloader.
27  
-    RRoEmbed\Autoloader::getInstance()->register();
28  
-
29  
-    // Create a new consumer.
30  
-    $consumer = new RRoEmbed\Consumer();
31  
-
32  
-    // Call the "consume" method and supply it the URL of the resource you'd like
33  
-    // to get the oEmbed representation of and the Provider instance.
34  
-    $resource = $consumer->consume(
35  
-        'http://www.youtube.com/watch?v=ThvBJMzmSZI',
36  
-        new RRoEmbed\Provider\YouTube()
37  
-    );
38  
-
39  
-    // Will call __toString()
40  
-    print $resource;
41  
-
42  
-    Result:
43  
-    <object width="480" height="295"> […] </object>
44  
-
45  
-    // You can also omit to specify the provider, if so the Consumer will try to
46  
-    // automatically find a valid provider endpoint.
47  
-    // Note that, as the Consumer class implements the __invoke method you
48  
-    // can use any of its instances as a callable.
49  
-    $resource = $consumer( 'http://www.youtube.com/watch?v=ThvBJMzmSZI' );
50  
-
51  
-    print_r( $resource );
52  
-
53  
-    Result:
54  
-
55  
-    RRoEmbed\Resource\Video Object
56  
-    (
57  
-        [_html:protected]            => <object width="480" height="295"><param name="movie" […]
58  
-        [_width:protected]           => 480
59  
-        [_height:protected]          => 295
60  
-        [_type:protected]            => video
61  
-        [_version:protected]         => 1.0
62  
-        [_title:protected]           => The Most AMAZING video on the internet #Egypt #jan25
63  
-        [_authorName:protected]      => hadi15
64  
-        [_authorUrl:protected]       => http://www.youtube.com/user/hadi15
65  
-        [_providerName:protected]    => YouTube
66  
-        [_providerUrl:protected]     => http://www.youtube.com/
67  
-        [_cacheAge:protected]        => 0
68  
-        [_thumbnailUrl:protected]    => http://i1.ytimg.com/vi/ThvBJMzmSZI/hqdefault.jpg
69  
-        [_thumbnailWidth:protected]  => 480
70  
-        [_thumbnailHeight:protected] => 360
71  
-    )
72  
-
  21
+```php
  22
+<?php
  23
+
  24
+// Include the autoloader.
  25
+require_once( __DIR__ . '/Classes/Autoloader.class.php' );
  26
+
  27
+// Register the autoloader.
  28
+RRoEmbed\Autoloader::getInstance()->register();
  29
+
  30
+// Create a new consumer.
  31
+$consumer = new RRoEmbed\Consumer();
  32
+
  33
+// Call the "consume" method and supply it the URL of the resource you'd like
  34
+// to get the oEmbed representation of and the Provider instance.
  35
+$resource = $consumer->consume(
  36
+    'http://www.youtube.com/watch?v=ThvBJMzmSZI',
  37
+    new RRoEmbed\Provider\YouTube()
  38
+);
  39
+
  40
+// Will call __toString()
  41
+print $resource;
  42
+
  43
+Result:
  44
+<object width="480" height="295"> […] </object>
  45
+
  46
+// You can also omit to specify the provider, if so the Consumer will try to
  47
+// automatically find a valid provider endpoint.
  48
+// Note that, as the Consumer class implements the __invoke method you
  49
+// can use any of its instances as a callable.
  50
+$resource = $consumer( 'http://www.youtube.com/watch?v=ThvBJMzmSZI' );
  51
+
  52
+print_r( $resource );
  53
+
  54
+Result:
  55
+
  56
+RRoEmbed\Resource\Video Object
  57
+(
  58
+    [_html:protected]            => <object width="480" height="295"><param name="movie" […]
  59
+    [_width:protected]           => 480
  60
+    [_height:protected]          => 295
  61
+    [_type:protected]            => video
  62
+    [_version:protected]         => 1.0
  63
+    [_title:protected]           => The Most AMAZING video on the internet #Egypt #jan25
  64
+    [_authorName:protected]      => hadi15
  65
+    [_authorUrl:protected]       => http://www.youtube.com/user/hadi15
  66
+    [_providerName:protected]    => YouTube
  67
+    [_providerUrl:protected]     => http://www.youtube.com/
  68
+    [_cacheAge:protected]        => 0
  69
+    [_thumbnailUrl:protected]    => http://i1.ytimg.com/vi/ThvBJMzmSZI/hqdefault.jpg
  70
+    [_thumbnailWidth:protected]  => 480
  71
+    [_thumbnailHeight:protected] => 360
  72
+)
  73
+```
73 74
     
74 75
 License
75 76
 -------
76  
-
77  
-The code is licensed under the very liberal [MIT license](http://opensource.org/licenses/mit-license.html).
  77
+Copyright (c) 2012 Romain Ruetschi  
  78
+Dual licensed under the [MIT](http://opensource.org/licenses/mit-license.html) and [GPL](http://www.gnu.org/licenses/gpl-2.0.html) licenses.

0 notes on commit a1dd6e6

Please sign in to comment.
Something went wrong with that request. Please try again.