Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
systems:yii2:third_party_components [2018/07/19 15:49]
smayr
systems:yii2:third_party_components [2018/08/14 17:00] (current)
smayr [yii2-phpspreadsheet PhpSpreadsheet]
Line 447: Line 447:
   * Pretty URL: http://localhost:8080/[app]/web/site/pdf-report   * Pretty URL: http://localhost:8080/[app]/web/site/pdf-report
  
 +==== References ==== 
 +  * [[systems:yii2:tcpdf]]
  
 == TinyMCE Editor == == TinyMCE Editor ==
Line 953: Line 954:
 </code> </code>
  
 +PHPExcel is deprecated.  Replaced by PHPSpreadsheet (use sunmoon/yii2-phpspreadsheet)
 +
 +==  yii2-phpspreadsheet PhpSpreadsheet ==
 +Get documentation from:
 +  * [[https://github.com/PHPOffice/PhpSpreadsheet]]
 +  * [[https://phpspreadsheet.readthedocs.io/en/develop/topics/migration-from-PHPExcel/]]
 +
 +Install the extension:
 +<code bash>
 +$ composer require sunmoon/yii2-phpspreadsheet '*'
 +</code>
 == DatePicker == == DatePicker ==
   * run in your project dir: <code>   * run in your project dir: <code>
Line 1152: Line 1164:
  
 This will try to send up to 100 emails every other minute. This will try to send up to 100 emails every other minute.
 +
 +== ReCaptcha ==
 +Install:
 +<code php>
 +$ composer require --prefer-dist "himiklab/yii2-recaptcha-widget" "*"
 +</code>
 +
 +Add to ''[app]/config/web.php'' file:
 +<code>
 +//...
 +$config = [
 +    //...
 +    'components' => [
 +      'reCaptcha' => [
 +         'name'    => 'reCaptcha',
 +         'class'   => 'himiklab\yii2\recaptcha\ReCaptcha',
 +         'siteKey' => 'sitekey',
 +         'secret'  => 'secret key',
 +       ],
 +     ],
 +  ],
 +];
 +//...  
 +</code>
 +
 +Add to form using reCaptcha:
 +<code php>
 +  // Remove
 +  <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
 +         'template' => '<div class="row"><div class="col-lg-3">{image}</div>
 +                        <div class="col-lg-6">{input}</div></div>',
 +  ]) ?>
 +  
 +  // Add
 +  <?= $form->field($model, 'reCaptcha')->widget(\himiklab\yii2\recaptcha\ReCaptcha::className()) ?>
 +</code>
 +
 +In the model, add this to the rules() and attributeLabels() methods:
 +<code php>
 +public function rules()
 +{
 +  return [
 +    [['name', 'email', 'subject', 'body','reCaptcha'], 'required'],
 +    //...
 +    // verifyCode needs to be entered correctly
 +    ['reCaptcha', \himiklab\yii2\recaptcha\ReCaptchaValidator::className(), 'secret' => '6LeTXQgUAAAAALExcpzgCxWdnWjJcPDoMfK3oKGi']
 +  ];
 +}
 +
 +//...
 +public function attributeLabels()
 +{
 +    return [
 +       //...
 +       'reCaptcha' => '',  // leave empty
 +    ];
 +}
 +</code>
 +
 +References: [[https://www.cloudways.com/blog/how-to-add-google-recaptcha-in-yii2/|How to add Google recaptcha in Yii2]]
 +
 +== yii2-cookie-consent ==
 +Install:
 +<code php>
 +$ composer require cinghie/yii2-cookie-consent "*"
 +</code>
 +
 +Usage:
 +<code php>
 +use cinghie\cookieconsent\widgets\CookieWidget;
 +
 +<?= CookieWidget::widget([ 
 +        'message' => 'This website uses cookies to ensure you get the best experience on our website.',
 + 'dismiss' => 'Got It',
 +        'learnMore' => 'More info',
 + 'link' => 'http://silktide.com/privacy-policy',
 + 'theme' => 'dark-bottom'
 +]); ?>
 +</code>
 +See: [[https://github.com/cinghie/yii2-cookie-consent]]
 +
  
 == Yii2 Authorizenet Gateway Extension == == Yii2 Authorizenet Gateway Extension ==
Line 1579: Line 1672:
   * [[https://github.com/AuthorizeNet/sdk-php|Authorized.Net PHP SDK]]   * [[https://github.com/AuthorizeNet/sdk-php|Authorized.Net PHP SDK]]
  
-== ReCaptcha == 
-Install: 
-<code php> 
-$ composer require --prefer-dist "himiklab/yii2-recaptcha-widget" "*" 
-</code> 
  
-Add to ''[app]/config/web.php'' file: 
-<code> 
-//... 
-$config = [ 
-    //... 
-    'components' => [ 
-      'reCaptcha' => [ 
-         'name'    => 'reCaptcha', 
-         'class'   => 'himiklab\yii2\recaptcha\ReCaptcha', 
-         'siteKey' => '##sitekey##', 
-         'secret'  => '##secret key##', 
-       ], 
-     ], 
-  ], 
-]; 
-//...   
-</code> 
- 
-References: [[https://www.cloudways.com/blog/how-to-add-google-recaptcha-in-yii2/|How to add Google recaptcha in Yii2]] 
- 
-== yii2-cookie-consent == 
-Install: 
-<code php> 
-$ composer require cinghie/yii2-cookie-consent "*" 
-</code> 
- 
-Usage: 
-<code php> 
-use cinghie\cookieconsent\widgets\CookieWidget; 
- 
-<?= CookieWidget::widget([  
-        'message' => 'This website uses cookies to ensure you get the best experience on our website.', 
- 'dismiss' => 'Got It', 
-        'learnMore' => 'More info', 
- 'link' => 'http://silktide.com/privacy-policy', 
- 'theme' => 'dark-bottom' 
-]); ?> 
-</code> 
-See: [[https://github.com/cinghie/yii2-cookie-consent]]