Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onroerenderfgoed/php-housenum-be-r-parser
PHP library for merging and splittings sequences of Belgian Housenumbers
https://github.com/onroerenderfgoed/php-housenum-be-r-parser
Last synced: about 5 hours ago
JSON representation
PHP library for merging and splittings sequences of Belgian Housenumbers
- Host: GitHub
- URL: https://github.com/onroerenderfgoed/php-housenum-be-r-parser
- Owner: OnroerendErfgoed
- License: mit
- Created: 2014-07-15T09:55:10.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-07-25T09:28:07.000Z (over 10 years ago)
- Last Synced: 2024-04-16T01:56:06.472Z (7 months ago)
- Language: PHP
- Size: 297 KB
- Stars: 2
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- License: LICENSE.md
Awesome Lists containing this project
README
Housenum-be-r-parser-php
========================A small library for merging and splitting sequences of Belgian housenumbers.
.. image:: https://travis-ci.org/OnroerendErfgoed/php-housenum-be-r-parser.png?branch=master
:target: https://travis-ci.org/OnroerendErfgoed/php-housenum-be-r-parser
.. image:: https://coveralls.io/repos/OnroerendErfgoed/php-housenum-be-r-parser/badge.png?branch=master
:target: https://coveralls.io/r/OnroerendErfgoed/php-housenum-be-r-parser?branch=master
.. image:: https://poser.pugx.org/oe/housenum-be-r-parser/v/stable.svg
:target: https://packagist.org/packages/oe/housenum-be-r-parserDescription
-----------Splits ranges of Belgian house numbers into individual ones and vice versa.
Installation
------------The HousenumBErParser can be installed through composer:
.. code-block:: js
//composer.json
{
"require": {
"oe/housenum-be-r-parser": "dev-master"
}
}Usage
-----Splitting a range of housenumbers:
.. code-block:: php
split('15-21');
foreach($split as $hnr) {
echo $hnr . "\n";
}Merging housenumbers:
.. code-block:: php
merge('17/1, 15, 20 bus C, 20 bus B, 17/3, 17/2, 20 bus A');
echo $facade->numbersToString($merge) . "\n";
The Facade can handle errors in three different ways. It can ignores errors
(the default way of handling errors). In this case invalid input will be left
as it is as much as possible. So, when trying to split the string
*25, something*, the resulting output will be *25, something*.The second option is to remove invalid input. This can be set by passing
*Reader::ERR_REMOVE_INVALID_INPUT* to the Facade constructor. In this case, invalid
input will be stripped as much as possible. So, when trying to split the string
*25, something*, the resulting output will be *25*.The third and final option is to throw *Exceptions*. This can be set by passing
*Reader::ERR_EXCEPTIONS* to the Facade constructor. In this case, invalid
input will trigger an *Exception*. So, when trying to split the string
*25, something*, an exception will be thrown.Other languages
---------------There is a similar library that does the same, but written in python.