andrij200390 / yii2-subscribe
Subscription extension in yii2. Send data in google spreadsheet
Installs: 37
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:yii2-extension
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: 2025-03-26 22:40:46 UTC
README
This is a simple bottom slide-in panel subscription module for Yii2. Can send data into Google Spreadsheets.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist andrij200390/yii2-subscribe "*"
or add
"andrij200390/yii2-subscribe": "*"
to the require section of your composer.json
file.
Documentation
This plugin has 3 working modes so far (and one utility):
- as array:
['telegram', 'instagram', 'vk']
- as string:
email
- as string:
telegram
- as string:
disabled
NOTE: In order to sync your data with Google Spreadsheets, follow the guide here. You will need to generate your
client_secret.json
file and store it in your environment for later usage.
[] array mode shows links to all services.
email mode can store user input data in Google Spreadsheet.
telegram mode simply shows predefined link to your channel.
disabled mode allows not to render subscription panel without actual plugin removal (i.e. if you need to disable panel temporary).
Usage
Once the extension is installed, simply put this code in desired view (full list of parameters included):
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 */ ] ] ]);