Skip to content

Visual-Craft/Utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visual Craft Utils

A collection of useful PHP classes

Install

composer require visual-craft/utils

Components

StringInterpolator

$interpolator = new \VisualCraft\Utils\StringInterpolator\StringInterpolator();
$interpolator->interpolate('Demonstration $var1 $var2. An${var3}er example \$var4', [
    'var1' => 'of',
    'var2' => 'interpolation',
    'var3' => 'oth',
]);
// Will return:
// "Demonstration of interpolation. Another example $var4"

$interpolator->getNames('Demonstration $var1 $var2. An${var3}er example \$var4');
// Will return:
// array (
//   0 => 'var1',
//   1 => 'var2',
//   2 => 'var3',
// )

TextBlockManager

CliArgsParser

Class used for parsing command line arguments coming from PHP $argv global variable

$parser = new \VisualCraft\Utils\CliArgsParser\CliArgsParser();

// $self - script name
// $args - arguments
// $opts - options
list($self, $args, $opts) = $parser->parse($argv);

Unit tests

composer install --dev
vendor/bin/kahlan

License

MIT

About

A collection of useful PHP classes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages