PHP code example of tonyaxo / yii2-typeform

1. Go to this page and download the library: Download tonyaxo/yii2-typeform library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tonyaxo / yii2-typeform example snippets


// 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);
        }
    }
}

php composer.phar