定制 dynamikaweb/yii2-youtube 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dynamikaweb/yii2-youtube

最新稳定版本:v1.1.1

Composer 安装命令:

composer require dynamikaweb/yii2-youtube

包简介

environment for use with youtube, has validators, helpers, apis, widgets...

README 文档

README

Latest Stable Version Total Downloads License Codacy Badge Build Test

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require dynamikaweb/yii2-youtube "*"

or add

"dynamikaweb/yii2-youtube": "*"

to the require section of your composer.json file.

Usage

Add it to your components

add to your components

'components' => [
    ...
    'youtube' => [
        'class' => \sr1871\youtubeApi\components\YoutubeApi::className(),
        'api_config' => [
            'clientId' => 'your Oauth Client Id, you can get it from google console',
            'clientSecret' => 'your Oauth Client Secret, you can get it from google console',
            'scopes' => ['scopes that you going to use', 'as array'],
        ],
        'channel' = 'youtube channel, which will be consulted'
    ],
    ...
]

generate your access token

An advantage of this component is that you only have to generate your access token once.

Create an action in any controller

public function actionYoutubeValidation() {
    if(Yii::$app->request->get('validate')){
        return $this->redirect(Yii::$app->youtube->validationGet(Yii::$app->urlManager->createAbsoluteUrl('/site/youtube-validation')));
    }

    if(Yii::$app->request->get('code')){
        Yii::$app->youtube->validationPost(Yii::$app->urlManager->createAbsoluteUrl('/site/youtube-validation'));
    } else {
        Yii::$app->session->setFlash('success', 'The access token was generated');
        return $this->redirect('index');
    }
}

To validate access to the action by passing the validate parameter come true. This will access google to do the validation and it will return to the same action by passing the parameter code with the Access Token.

Example:

https://yoursite.com.br/site/youtube-validation?validate=1

Example

Yii::$app->youtube->setParts(['snippet', 'recordingDetails', 'id'])->listVideos(['id' => 'someId'])

You can pass in setParts(), the parts that you want, if you don't want the default parts. For more information of every method and how do it, read the PhpDOC of component's methods

统计信息

  • 总下载量: 1.21k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2021-01-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固