Snaps in php

php

web programming language

TimestampBehavior to autmatically set datetime values of created_at and updated_at. If fields have other name than default, names can be overwite...

php yii2 activerecord datetime

Yii2 check if record exists with where condition...

yii2 php

php

Clarification will help for people who aren't sure. You first create a variable to store your information, then call the php date function so that it is stored in the variable. Add format parameters so the date is displayed the way you'd like i...

php mysql date

php

Finding first and last item of an array using end and reset functions...

php array find

Gettin logged user in yii2 framework...

yii2 php logged user get

Check if request is ajax request....

yii2 php ajax request

php

To get class from namespace path array_pop can be used....

php namespace

kohana - Html render anchor with route...

php kohana HTML anchor

For get query from ActiveRecord:...

php framework yii2 activerecord

yii2 select query using raw query binding parameters and data reader...

php yii2 datareader array

Displaying checkbox for boolean value from database on active form. For example model has field - active....

yii2 active-form checkbox

When switchery plugin is implemented correctly all what is needed is:...

yii2 checkbox active-form

To enable pretty (SEO friendly) url's edit configuration file as follows: For basic yii2 template Edit /config/web.php and add entry into components array like this:...

php yii2 url

To remove index.php from url:...

php yii2 url

Steps for installing Yii2 framework with composer:...

yii2 framework composer

Creating module in yii2 can be done in two difrent ways: 1. manually 2. by gii generator Assuming the framework is installed and running and we want to create module called: 'examplemodule'...

php framework yii2 module

php

Checking if file in $_FILES is an image....

php

To solve this error translation configuration must be added to config. In config/web.php add folowing array in 'components' array....

php yii2 translation array

php

If class name if for example string class methods can be read with ReflectionClass like this...

php class methods reflection

To automatically set created_at and updated_at TimestampBehavior can be used. In model extending ActiveRecord put following lines:...

php yii2 date activerecord