PHPackages                             lionser/cidr - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. lionser/cidr

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

lionser/cidr
============

Library for parse CIDR from ip range.

2.0.0(3y ago)16.7k↓87.5%MITPHPPHP ^8.1CI failing

Since Nov 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/lionser/CIDR)[ Packagist](https://packagist.org/packages/lionser/cidr)[ Docs](https://github.com/lionser/cidr)[ RSS](/packages/lionser-cidr/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (3)Versions (11)Used By (0)

The CIDR library for create CIDR's from IP range.
=================================================

[](#the-cidr-library-for-create-cidrs-from-ip-range)

[![Build Status](https://camo.githubusercontent.com/fcad88c8d963f33f6ca4f5219e623acfa0205ab3a116aabeabf0ad99cea6c1e2/68747470733a2f2f7472617669732d63692e636f6d2f6c696f6e7365722f636964722e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/fcad88c8d963f33f6ca4f5219e623acfa0205ab3a116aabeabf0ad99cea6c1e2/68747470733a2f2f7472617669732d63692e636f6d2f6c696f6e7365722f636964722e7376673f6272616e63683d6d6173746572)[![PHP from Packagist](https://camo.githubusercontent.com/6eacdd6284c77332eb1e7ce143eb078312222f818488fb921e207217f1fed669/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c696f6e7365722f63696472)](https://camo.githubusercontent.com/6eacdd6284c77332eb1e7ce143eb078312222f818488fb921e207217f1fed669/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c696f6e7365722f63696472)[![Version](https://camo.githubusercontent.com/aafb9775768b7d4f60bd3fb749fb86d547d867aeb6f1da9725fe69313143c254/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c696f6e7365722f63696472)](https://camo.githubusercontent.com/aafb9775768b7d4f60bd3fb749fb86d547d867aeb6f1da9725fe69313143c254/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c696f6e7365722f63696472)[![Coverage Status](https://camo.githubusercontent.com/5782b720bd8d2d67e08c8bd90ffcc7d29f3c97d92e25c6908815436edd0b176f/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6769746875622f6c696f6e7365722f434944522f6d6173746572)](https://camo.githubusercontent.com/5782b720bd8d2d67e08c8bd90ffcc7d29f3c97d92e25c6908815436edd0b176f/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6769746875622f6c696f6e7365722f434944522f6d6173746572)[![License](https://camo.githubusercontent.com/747328792468fda03228184b66bfbc5b61f3a55161bef35ced6fbc6023cb7502/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c696f6e7365722f63696472)](https://camo.githubusercontent.com/747328792468fda03228184b66bfbc5b61f3a55161bef35ced6fbc6023cb7502/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c696f6e7365722f63696472)

CIDR - Classless Inter-Domain Routing. [Wiki](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)

Installing CIDR Library
-----------------------

[](#installing-cidr-library)

The recommended way to install CIDR Library is through [Composer](http://getcomposer.org).

```
# Install Composer
curl -sS https://getcomposer.org/installer | php
```

Next, run the Composer command to install the latest stable version of CIDR Library:

```
composer require lionser/cidr
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

You can then later update CIDR Library using composer:

```
composer update
```

Usage example:

```
$netmaskDetectror = new \Lionser\Detector\NetmaskDetector();
$parser           = new \Lionser\Parser\CIDRRangeParser($netmaskDetectror);

$start = new \Lionser\ValueObject\IP\IPv4('1.0.0.0');
$end   = new \Lionser\ValueObject\IP\IPv4('1.0.0.255');
$range = new \Lionser\ValueObject\IP\Range($start, $end);

/** @var $cidrs \Lionser\ValueObject\CIDR[] */
$cidrs = $parser->parseRange($range);

# Or facade usage

/** @var $cidrs \Lionser\ValueObject\CIDR[] */
$cidrs = \Lionser\Parser\CIDRParserFacade::parse('1.0.0.0', '1.0.0.255');

foreach($cidrs as $cidr) {
    echo $cidr; # '1.0.0.0\24'
}
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 71.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~114 days

Recently: every ~257 days

Total

10

Last Release

1388d ago

Major Versions

1.0.8 → 2.0.02022-09-14

PHP version history (2 changes)1.0.0PHP ^7.1

2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9616b9b8bec17f82f0d19e4333bffc690e55238763e6706c529f494186c1b989?d=identicon)[Lionser](/maintainers/Lionser)

---

Top Contributors

[![lionser](https://avatars.githubusercontent.com/u/26322780?v=4)](https://github.com/lionser "lionser (20 commits)")[![Formmeras](https://avatars.githubusercontent.com/u/124682454?v=4)](https://github.com/Formmeras "Formmeras (8 commits)")

---

Tags

parserIPcidrip range

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/lionser-cidr/health.svg)

```
[![Health](https://phpackages.com/badges/lionser-cidr/health.svg)](https://phpackages.com/packages/lionser-cidr)
```

###  Alternatives

[nikic/php-parser

A PHP parser written in PHP

17.4k954.1M2.5k](/packages/nikic-php-parser)[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k959.8M160](/packages/doctrine-lexer)[erusev/parsedown

Parser for Markdown.

15.1k156.8M867](/packages/erusev-parsedown)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

3.0k437.5M1.0k](/packages/league-commonmark)[masterminds/html5

An HTML5 parser and serializer.

1.8k269.7M320](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k211.0M75](/packages/sabberworm-php-css-parser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
