To get a local copy up and running follow these simple steps.
- PHP7.4+
- ext-mbstring
- Composer
Use composer from the root of your project folder to download the library.
composer require switchcat/range-regex
All method return an array containing either the element's data either an array of elements with their data.
- Create the periodic object
use SwitchCat\RangeRegex\FactoryDefault;
use SwitchCat\RangeRegex\Range;
$Factory = new FactoryDefault();
$converter = $Factory->getConverter();
$Range = new Range(int $min, int $max);
$regex = sprintf('/^(%s)$/', $converter->toRegex($Range));
// /^([1-9]|[1-9][0-9]|[1-9][0-9]{2}|[1-2][0-9]{3}|3[0-3][0-9]{2}|34[0-4][0-9]|345[0-6])$/
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
No major change has been brought to the original package. Basically ported it to php7.4 (fixed compatibility issues) and added a test suite. Some code optimization has been done in order to comply with code inspection standards. The package was marked "abandoned" and i found it very usefull. I simply decided to give it a second life.
Based on the work of: