PHP code example of raoul2000 / yii2-twbsmaxlength-widget
1. Go to this page and download the library: Download raoul2000/yii2-twbsmaxlength-widget 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/ */
raoul2000 / yii2-twbsmaxlength-widget example snippets
class ContactForm extends Model
{
public $subject;
/**
* @return array the validation rules.
*/
public function rules()
{
return [
['subject','string', 'length'=> [4,10]],
];
}
// ....
use raoul2000\widget\twbsmaxlength\TwbsMaxlength;
$form = ActiveForm::begin();
echo $form->field($model, 'subject')->widget(TwbsMaxlength::className());
ActiveForm::end();