1. Go to this page and download the library: Download mention/kebab 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/ */
mention / kebab example snippets
// Only accept string as subject and returns a string
PcreUtils::replace('/bar/', 'foo', 'foobarbaz');
// Only accept array as subject and returns an array
PcreUtils::replaceMultiple('/foo/', 'bar', ['foo', 'foo']);
// Only accept string as subject and returns a string
PcreUtils::replaceArray(['/foo/' => 'bar'], 'foo');
// Only accept array as subject and returns an array
PcreUtils::replaceArrayMultiple(['/foo/' => 'bar'], ['foo', 'foo']);
// Only accept string as subject and returns a string
PcreUtils::replaceCallback('/\d/', $callback, '123');
// Only accept array as subject and returns an array
PcreUtils::replaceCallbackMultiple('/\d/', $callback, ['1', '2']);
// Only accept string as subject and returns a string
PcreUtils::replaceCallbackArray($patternsAndCallbacks, '123');
// Only accept array as subject and returns an array
PcreUtils::replaceCallbackArrayMultiple($patternsAndCallbacks, ['1', '2']);
// Only accept string as subject and returns a string
PcreUtils::filter('/bar/', 'foo', 'foobarbaz');
// Only accept array as subject and returns an array
PcreUtils::filterMultiple('/foo/', 'bar', ['foo', 'foo']);
// Only accept string as subject and returns a string
PcreUtils::filterArray(['/foo/' => 'bar'], 'foo');
// Only accept array as subject and returns an array
PcreUtils::filterArrayMultiple(['/foo/' => 'bar'], ['foo', 'foo']);
// Always returns a boolean or throws on error
PcreUtils::match('/bar/', 'foobarbaz');
// Returns number of hits that matched or throws on error
PcreUtils::matchAll('/foo/', 'foobarbaz');
// Split string by a regular expression
PcreUtils::split('/\d/', 'foo1bar2baz');
// Quote regular expression characters
PcreUtils::quote('foo$bar');
php
Clock::enableMocking(946681200); // 946681200 can be any arbitrary timestamp
Clock::time(); // int(946681200)
Clock::microtimeFloat(); // float(946681200.0)
Clock::usleep(5500000); // returns immediately (no actual sleep)
Clock::microtimeFloat(); // float(946681205.5) : clock has advanced by 5500000 micro seconds
Clock::disableMocking();
php
DateUtils::now(); // Same as new \DateTimeImmutable();
DateUtils::nowMutable(); // Same as new \DateTime();
DateUtils::nowTz($timezone); // Same as new \DateTimeImmutable('now', $timezone);
DateUtils::fromString($dateString); // Same as new \DateTimeImmutable($dateString);
DateUtils::fromString($dateString, $format); // Same as \DateTimeImmutable::createFromFormat($format, $dateString);
DateUtils::fromStringMutable($dateString); // Same as new \DateTime($dateString);
DateUtils::fromStringMutable($dateString, $format); // Same as \DateTime::createFromFormat($format, $dateString);
DateUtils::fromStringTz($dateString, $timezone); // Same as new \DateTimeImmutable($dateString, $timezone);
DateUtils::fromStringTz($dateString, $timezone, $format); // Same as \DateTimeImmutable::createFromFormat($format, $dateString, $timezone);
DateUtils::fromTimestamp($timestamp); // Same as \DateTimeImmutable::createFromFormat("|U", (string) $timestamp);
DateUtils::fromTimestamp($timestamp, $micro); // Same as \DateTimeImmutable::createFromFormat("U u", "$timestamp $micro");
php
FileUtils::read($file); // Reads file $file, throws exception on failure
FileUtils::open($file, $mode); // Opens file $file, throws exception on failure
php
JsonUtils::encode($value); // json_encode, with exceptions on failure
JsonUtils::encodePretty($value); // returns pretty-printed JSON, throw exceptions on failure
JsonUtils::prettify($json); // prettifies a JSON string
JsonUtils::decodeObject($json); // decodes a JSON string, use stdClass to represent JSON objects (same as json_decode($value, false))
JsonUtils::decodeArray($json); // decodes a JSON string, use arrays to represent JSON objects (same as json_decode($value, true))
php
LogUtils::truncate($veryLargeString); // Truncates to 255 characters by default.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.