nijens / range
Ruby range syntax parser for PHP.
Installs: 11 298
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^5.5 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^4.8
- satooshi/php-coveralls: ^1.0
This package is auto-updated.
Last update: 2024-11-19 10:04:54 UTC
README
Ruby range syntax parser for PHP.
Installation using Composer
Run the following command to add the package to the composer.json of your project:
$ composer require nijens/range
Usage
Parsing a range in Ruby syntax:
<?php use Nijens\Range\Range; $range = Range::parse('0..1'); echo $range->getFrom(); // Output: 0 echo $range->getTo(); // Output: 1
Converting a Range instance to Ruby range syntax:
<?php use Nijens\Range\Range; $range = new Range(0, 1, false); echo $range; // Output: 0..1