andrij200390 / yii2-subscribe
yii2的订阅扩展。可以将数据发送到谷歌表格
dev-master
2019-04-10 19:09 UTC
Requires
- asimlqt/php-google-spreadsheet-client: 3.0.*
- google/apiclient: ~2.0
- yiisoft/yii2: ~2.0.0
This package is not auto-updated.
Last update: 2024-09-25 20:00:20 UTC
README
这是一个简单的底部滑动面板订阅模块,适用于Yii2。可以将数据发送到谷歌表格。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令
php composer.phar require --prefer-dist andrij200390/yii2-subscribe "*"
或在您的 composer.json 文件的 require 部分添加
"andrij200390/yii2-subscribe": "*"
到
文档
此插件目前有3种工作模式(以及一个实用工具)
- 作为数组:
['telegram', 'instagram', 'vk'] - 作为字符串:
email - 作为字符串:
telegram - 作为字符串:
disabled
注意:为了将您的数据同步到谷歌表格,请遵循此处的指南。您需要生成您的
client_secret.json文件并将其存储在您的环境中以供以后使用。
[] 数组模式显示所有服务的链接。
email 模式可以将用户输入的数据存储在谷歌表格中。
telegram 模式仅显示到您频道的预设链接。
disabled 模式允许在不实际删除插件的情况下不渲染订阅面板(即如果您需要临时禁用面板)。
用法
一旦安装了扩展,只需将此代码放入所需的视图(包括参数的完整列表)
use andrij200390\subscribe\Subscribe; echo Subscribe::widget([ 'mode' => 'email', /* 'email' or 'telegram' or ['telegram', 'instagram']. Default: 'disabled' */ 'cookie' => [ 'name' => 'subscribe', /* NOT IMPLEMENTED YET - hardcoded in JS */ 'max-age' => 0, /* NOT IMPLEMENTED YET - hardcoded in JS */ ], 'style' => [ 'background' => 'dark', /* `green`, `blue`, `dark` - applies as a modifier to class name */ 'textcolor' => 'white' /* `black`, `white` - applies as a modifier to class name */ ] 'email' => [ 'message' => '', /* Main text for email subscription */ 'submitButtonText' => '', /* Text for send button */ 'placeholderText' => '', /* Text inside input placeholder */ ], 'telegram' => [ 'message' => '', /* Main text for Telegram subscription */ 'submitButtonText' => '', /* Text for subscription button */ 'channelName' => '', /* i.e. `outstyle` */ ], 'instagram' => [ 'message' => '', /* Main text for Instagram subscription */ 'submitButtonText' => '', /* Text for subscription button */ 'channelName' => '', /* i.e. `outstyle` */ ], 'vk' => [ 'message' => '', /* Main text for VK subscription */ 'submitButtonText' => '', /* Text for subscription button */ 'channelName' => '', /* i.e. `outstyle` */ ], 'all' => [ 'message' => '' /* General message for all services */ ], 'provider' => [ 'google' => [ 'spreadsheet' => [ 'title' => '', 'column' => '', ], 'clientSecretJSON' => '' /* To be documented yet */ ] ] ]);