 <p>You can use it this way: <a href="http://www.yiiframework.com/extension/yii2-helpers/" rel="nofollow">http://www.yiiframework.com/extension/yii2-helpers/</a></p> <p>Create a folder <code>/common/helpers/</code>, then create a helper class there and add your static methods.</p> <pre><code>namespace common\helpers; class DateHelper { public static function dt(){ return date('Y-m-d H:i:s'); } } </code></pre> <p>Usage</p> <pre><code>use common\helpers\DateHelper; echo DateHelper::dt(); </code></pre>