PHP code example of jtrw / devutils

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

    

jtrw / devutils example snippets


dd(['test' => 1]);

$str = transliterate($str);

CliUtils::e('Some message'); // Output: [ERROR] Some message
CliUtils::i('Some message'); // Output: [INFO] Some message
CliUtils::s('Some message'); // Output: [OK] Some message
CliUtils::w('Some message'); // Output: [WARNING] Some message

CliUtils::color('Some text', 'red');

class SomeClass
{
    use Jtrw\DevUtils\Logger\Traits\LoggerTrait;

    public function (LoggerInterface $logger)
    {
        $this->setLogger($logger)
    }

    public function doSome(array $params)
    {
        $this->i("Info for debug");
        $this->d("Debug something", $params);
        try {
            //Some logic
        } catch (Exception $exp) {
            $this->logException($exp, LOG_CRIT, "Exception happened");
        }
    }
}