PHP code example of sergmoro1 / yii2-ru-kit

1. Go to this page and download the library: Download sergmoro1/yii2-ru-kit 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/ */

    

sergmoro1 / yii2-ru-kit example snippets


use sergmoro1\rukit\FullDate;
use sergmoro1\rukit\Translit;

class Post extends ActiveRecord
{
  ...
  public function behaviors() {
    return [
      ['class' => FullDate::className()],
      ['class' => Translit::className()],
    ];
  }
  ...
  // Translit
  public function beforeSave($insert)
  {
    if(parent::beforeSave($insert))
    {
      $this->translit();
      return true;
    } else
        return false;
  }

<?= $model->fullDate('created_at'); // ru-RU -> 21 Фев 2018 

<?= $model->fullDate('created_at', 'M Y'); // en-US -> Feb 2018 

<?= $model->fullDate('created_at', 'F d из t, Y (e)'); // ru-Ru -> Февраль 13 из 28, 2018 (UTC)