overblog/embedly-bundle

该软件包的最新版本(v1.2)没有可用的许可信息。

OverBlog Embedly Bundle

v1.2 2012-11-21 16:30 UTC

This package is auto-updated.

Last update: 2024-09-05 18:41:23 UTC


README

OverblogEmbedlyBundle 是一个简单的 Symfony 扩展包,它提供了访问 embed.ly php 库(https://github.com/embedly/embedly-php)的权限。

更多信息请访问 http://embed.ly

安装

  1. 将此扩展包和 embedly-php 库添加到您的 vendor/ 目录。

    • 使用 vendors 脚本。

      在您的 deps 文件中添加以下行:

      [OverblogEmbedlyBundle]
          git=git://github.com/ebuzzing/OverblogEmbedlyBundle.git
          target=/bundles/Overblog/EmbedlyBundle
      
      [embedly-php]
          git=git://github.com/embedly/embedly-php.git
          target=/embedly-php
      

      运行 vendors 脚本

      ./bin/vendors install
      
    • 使用 git 子模块。

      $ git submodule add git=git://github.com/ebuzzing/OverblogEmbedlyBundle.git vendor/bundles/Overblog/EmbedlyBundle
      $ git submodule add git://github.com/embedly/embedly-php.git vendor/embedly-php
      
  2. 将 Overblog 命名空间添加到您的自动加载器中

          // app/autoload.php
          $loader->registerNamespaces(array(
                'Overblog' => __DIR__.'/../vendor/bundles',
                'Embedly'   => __DIR__.'/../vendor/embedly-php/src'
                // your other namespaces
          ));
  1. 将此扩展包添加到您的应用程序的内核中
          // app/ApplicationKernel.php
          public function registerBundles()
          {
              return array(
                  // ...
                  new Overblog\EmbedlyBundle\OverblogEmbedlyBundle(),
                  // ...
              );
          }
  1. 在您的配置中配置 overblog_embedly 服务
    overblog_embedly:
        config:
            key: your_api_key

示例

在控制器中,执行以下操作:

        $embedly = $this->get('overblog_embedly');
        $oembedResponse = $embedly->get('http://about.over-blog.com/article-participez-a-la-conception-de-la-prochaine-version-d-overblog-91418456.html');
        /*
            object(stdClass)[1251]
  public 'provider_url' => string 'http://about.over-blog.com/' (length=27)
  public 'description' => string 'Mardi 6 décembre 2011 2 06 /12 /Déc /2011 12:44 Dans les mois à venir, nous allons développer une version complètement nouvelle d'OverBlog. La nouvelle version remplacera l'actuelle plateforme, elle sera plus fonctionnelle, plus simple et vos blogs actuels en bénéficieront automatiquement !' (length=298)
  public 'title' => string 'Participez à la conception de la prochaine version d'OverBlog !' (length=64)
  public 'url' => string 'http://about.over-blog.com/article-participez-a-la-conception-de-la-prochaine-version-d-overblog-91418456.html' (length=110)
  public 'thumbnail_width' => int 439
  public 'thumbnail_url' => string 'http://idata.over-blog.com/0/00/63/43/perenoel.jpg' (length=50)
  public 'version' => string '1.0' (length=3)
  public 'provider_name' => string 'Over-blog' (length=9)
  public 'type' => string 'link' (length=4)
  public 'thumbnail_height' => int 269
        */