PHP code example of denis-kisel / helper

1. Go to this page and download the library: Download denis-kisel/helper 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/ */

    

denis-kisel / helper example snippets

 php
use DenisKisel\Helper\AStr;

...

// Get substring by mask
AStr::getContent('{*}', 'some {placeholder} text');
// Return:
// placeholder

AStr::getContent('Hello * world', 'Hello wonderful world');
// Return:
// wonderful


// Remove substring by mask
$text = 'some {placeholder} text';
AStr::rm('{*}', $text);
// Return:
// {placeholder}

echo $text;
// Output:
// some text


// Check substring by mask
AStr::is('Hello * world', 'Hello wonderful world');
// Return:
// (boolean)true


// Format text
AStr::formatText('Some text', 3);
// Return:
// \t\t\tSome text\n


// Get path by class
AStr::pathByClass('App\\Models\\Page');
// Return: absolute path to input class


// Append substring
$text = <<<EOF
    function() {
        //TODO
    }
EOF;

AStr::append('function() {', 'echo __LINE__;', $text, $countTabs = 2);
// Return
//    function() {
//        echo __LINE__;
//        //TODO
//    }


// Prepend substring
$text = <<<EOF
    function() {
        //TODO
    }
EOF;

AStr::prepend('}', 'echo __LINE__;', $text, $countTabs = 2);
// Return
//    function() {
//        //TODO
//        echo __LINE__;
//    }
...