PHP code example of gozoro / yii2-helpers

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

    

gozoro / yii2-helpers example snippets



Html::rus2translit("привет мир"); // privet mir

Html::str2url("привет мир!") // privet-mir

Html::text("это ссылка http://example.com") // это ссылка <a href="http://example.com">http://example.com</a>

Html::csrfHiddenInput(); //  Return string with CSRF hidden input

Html::video("./example.mp4") // Returns string with video tag or youtube-iframe.


$options = [
	'valueString' => 'string',
	'valueInt'    => 5,
	'valueFloat'  => 4.3,
	'valueNull'   => null,
	'valueBool'   => true,
	'valArray'    => ['a', 'b', 'c'],
	'valAssoc'    => ['a'=>'apple', 'b'=>2, 'c'=>1],
	'func'        => 'function(val){return val;}',
];

Json::optionsEncode($options);


$url = new Url("https://example.com/my-path");
echo $url->getScheme(); // https
echo $url->getHost(); // example.com
echo $url->getPath(); // /my-path
// etc