Zend 框架 2.0.2 YouTube API [英] Zend Framework 2.0.2 YouTube API

查看:17
本文介绍了Zend 框架 2.0.2 YouTube API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎在新的 Zend Framework 2.0.2 上找不到任何 YouTube API 文档.我需要做任何外部或额外下载吗?所有教程均基于旧版本的 Zend!

I cant seem to find any YouTube API documents on the new Zend Framework 2.0.2. Is there any external or extra downloads I need to do? All the tutorials are based on older versions of Zend!

或者我应该只下载旧版本的 Zend?

Or should I just download an older version of Zend?

我正在为将来可能需要它的其他人提供这个答案.

I'm giving this answer for anyone else that may need it in the future.

您必须下载 Zend Framework 1.7.7.由于 YouTube API 使用 Gdata 文件夹.根据我的研究,这是唯一支持 YouTube API 的版本.

You will have to download Zend Framework 1.7.7. As the YouTube API uses the Gdata folder. On my research this is the only version that will support the YouTube API.

希望这对某人有所帮助.

Hope this helps someone.

推荐答案

GData API 在 ZF2 中可用,您只需要安装包含它的包.

The GData API is available in ZF2, you just need to install the package that contains it.

您可以在此处找到可用软件包的列表.

You can find a list of available packages here.

如果您已经在使用 Composer for ZF2,只需将 "zendframework/zendgdata": "2.0.*" 添加到 require 部分的包列表中,然后运行 php composer.phar update 以获取 GData 包,您现在可以开始使用 GData 类了.

If you are already using Composer for ZF2, simply add "zendframework/zendgdata": "2.0.*" to the list of pacakges in the require section and then run php composer.phar update to fetch the GData package and you can now begin using the GData classes.

如果您不使用 Composer,您可以通过以下方式获取 GData\YouTube 库.

If you aren't using Composer, here is how you can obtain the GData\YouTube library.

从新目录安装 Composer:

From a new directory, install Composer:

curl -s https://getcomposer.org/installer | php

注意:如果你没有 cURL,只需从上面的 URL 下载安装程序并运行 php installer

Note: If you don't have cURL, just download the installer from the above URL and run php installer

现在 Composer 已安装,创建一个 composer.json 文件,其中包含以下内容:

Now that Composer is installed create a composer.json file with the following contents:

{
    "repositories": [
        {
            "type": "composer",
            "url": "http://packages.zendframework.com/"
        }
    ],
    "require": {
        "zendframework/zendgdata": "2.0.*"
    }
}

通过将 zendframework/zendgdata 包添加到 require 列表中,composer 将下载并安装该包以及 ZF2.

By adding the zendframework/zendgdata package to the require list, composer will download and install this package along with ZF2.

现在运行安装:

php composer.phar install

您现在在新创建的 vendor 目录中拥有 Zend Framework 2 和 GData 包的副本.

You now have a copy of Zend Framework 2 and the GData package in the newly created vendor directory.

为了测试它,在与 composer.json 相同的目录中创建 test.php,如下所示:

To test it, create test.php in the same directory as composer.json that looks like this:

<?php

require_once 'vendor/autoload.php';

$youtube = new ZendGData\YouTube();

var_dump($youtube);

ZF2 中 GData YouTube API 的使用与 ZF1 中的类似,但是如果您查看 vendor/zendframework/zendgdata/tests/ZendGData/ 目录,您可以看到许多测试您可以将其用作各种 ZF2 YouTube 课程入门的示例.

The usage of the GData YouTube APIs in ZF2 are similar to in ZF1, but if you look in the vendor/zendframework/zendgdata/tests/ZendGData/ directory, you can see a number of tests which you can use as examples for getting started with the various ZF2 YouTube classes.

希望有所帮助.

这篇关于Zend 框架 2.0.2 YouTube API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆