validators\BooleanValidator $falseValue

$falseValue public property The value representing false status. Defaults to '0'. public mixed $falseValue = '0'

Validating Input

Declaring Rules Ad Hoc Validation Creating Validators Client-Side Validation As a rule of thumb, you should never trust the data received from end users and should always validate it before putting it to good use. Given a model populated with user inputs, you can validate the inputs by calling the yii\base\Model::validate() method. The method will return a boolean value indicating whether the validation succeeded or not. If not, you may get the error messages from the yii\base\Model::$errors p

Using template engines

By default, Yii uses PHP as its template language, but you can configure Yii to support other rendering engines, such as Twig or Smarty available as extensions. The view component is responsible for rendering views. You can add a custom template engine by reconfiguring this component's behavior: [ 'components' => [ 'view' => [ 'class' => 'yii\web\View', 'renderers' => [ 'tpl' => [ 'class' => 'yii\smarty\Vi

Uploading Files

Creating Models Rendering File Input Wiring Up Uploading Multiple Files Uploading files in Yii is usually done with the help of yii\web\UploadedFile which encapsulates each uploaded file as an UploadedFile object. Combined with yii\widgets\ActiveForm and models, you can easily implement a secure file uploading mechanism. Creating Models Like working with plain text inputs, to upload a single file you would create a model class and use an attribute of the model to keep the uploaded file insta

twig\ViewRenderer setLexerOptions()

setLexerOptions() public method Sets Twig lexer options to change templates syntax public void setLexerOptions ( $options )$options array @see self::$lexerOptions

twig\ViewRenderer render()

render() public method Renders a view file. This method is invoked by yii\base\View whenever it tries to render a view. Child classes must implement this method to render the given view file. public string render ( $view, $file, $params )$view yii\base\View The view object used for rendering the file. $file string The view file. $params array The parameters to be passed to the view file. return string The rendering result

twig\ViewRenderer init()

init() public method public void init ( )

twig\ViewRenderer addGlobals()

addGlobals() public method Adds global objects or static classes public void addGlobals ( $globals )$globals array @see self::$globals

twig\ViewRenderer addFunctions()

addFunctions() public method Adds custom functions public void addFunctions ( $functions )$functions array @see self::$functions

twig\ViewRenderer addFilters()

addFilters() public method Adds custom filters public void addFilters ( $filters )$filters array @see self::$filters