tonyaxo/yii2-typeform

Typeform.com integration for the Yii framework

Installs: 730

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

0.4.1 2018-11-06 16:22 UTC

This package is not auto-updated.

Last update: 2024-05-18 15:35:30 UTC


README

993323

Typeform.com Extension for Yii 2


Typeform.com yii2 integration

Build Status Coverage Status Maintainability

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist tonyaxo/yii2-typeform "*"

or add

"tonyaxo/yii2-typeform": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

// SiteController.php
public function actions()
{
    return [
        'index' => [
            'class' => 'tonyaxo\yii2typeform\AuthAction',
            'successCallback' => [$this, 'onAuthSuccess'],
        ],
    ];
}
// auth-view.php
<?= \tonyaxo\yii2typeform\widgets\Auth::widget([
        'baseAuthUrl' => ['/authorize/index'],
        'linkOptions' => [
                'class' => 'btn btn-info'
        ]
]);
// user.php
class MyTypeForm extends EmbeddedTypeForm
{
    const BASE_FORM_URL = 'https://myaccount.typeform.com/to/';

    public $type = EmbeddedTypeForm::TYPE_POPUP;

    /**
     * @param mixed $id
     */
    public function setFormId(?string $id): void
    {
        if ($id !== null) {
            $this->setUrl(self::BASE_FORM_URL . $id);
        }
    }
}