sergmoro1/yii2-google-spreadsheet

通过Google REST API从Yii2访问Google SpreadSheet。

安装: 239

依赖: 0

建议者: 0

安全: 0

星标: 1

关注者: 3

分支: 1

开放问题: 1

类型:yii2-extension

dev-master 2024-05-17 15:15 UTC

This package is auto-updated.

Last update: 2024-09-17 15:59:31 UTC


README

一个简单的扩展,用于获取用户的工作表列表并在IFRAME中打开所选工作表。

使用Google REST API和OAuth2授权的示例。

安装

首先注册Google项目

按照说明操作 - 设置OAuth 2.0

设置扩展

$ composer require sergmoro1/yii2-google-spreadsheet "dev-master"

用法

1.将./example中的模型、控制器和视图复制到您应用程序的相应目录。更改方法或操作,或保持原样。

2.在params文件中定义常量(例如,在frontend/config/params.php中)。

<?php
return [
    'clientId' => '***',
    'clientSecret' => '***',
    // dev (for ex.)
    'redirectUri' => 'https:///yoursite/frontend/web/google/oauth',
    // production
    //'redirectUri' => 'http://yoursite/google/oauth',
];

3.在您的Google项目中声明重定向URI。例如:

// 开发
https:///yousite/frontend/web/google/oauth2

// 生产
http://yoursiteDOTcom/google/oauth2

结果

现在您可以通过当前激活的Uri查看您的工作表列表,如果您有工作表的话

http://yoursite_or_localhost_path/google