PHPackages                             makowskid/dcfparser - 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. makowskid/dcfparser

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

makowskid/dcfparser
===================

DcfParser - parse Debian Control Files with PHP

2.0.0(4mo ago)0690MITPHPPHP ^8.2CI failing

Since Nov 15Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/makowskid/dcfparser)[ Packagist](https://packagist.org/packages/makowskid/dcfparser)[ RSS](/packages/makowskid-dcfparser/feed)WikiDiscussions master Synced today

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

DcfParser
=========

[](#dcfparser)

**DcfParser** is a PHP &amp; Laravel package to parse Debian Control Files (DCF format).

Requirements
------------

[](#requirements)

- PHP 8.2+

Installation
------------

[](#installation)

```
composer require makowskid/dcfparser
```

Usage
-----

[](#usage)

### Parse a file (first stanza)

[](#parse-a-file-first-stanza)

```
$parser = new \makowskid\DcfParser\DcfParser();
$data = $parser->parseFile('/path/to/control');
// ['source' => 'gentoo', 'section' => 'games', ...]
```

### Parse a string

[](#parse-a-string)

```
$data = $parser->parseString("Source: gentoo\nSection: games\n");
```

### Parse all stanzas

[](#parse-all-stanzas)

DCF files can contain multiple stanzas (paragraphs) separated by blank lines:

```
$stanzas = $parser->parseFileAll('/path/to/control');
// or
$stanzas = $parser->parseStringAll($content);

// Returns: [['source' => 'gentoo', ...], ['package' => 'gentoo', ...]]
```

### Laravel

[](#laravel)

The package auto-discovers its service provider. Use the facade:

```
\DcfParser::parseFile('/path/to/control');
\DcfParser::parseString($content);
\DcfParser::parseFileAll('/path/to/control');
\DcfParser::parseStringAll($content);
```

DCF Format
----------

[](#dcf-format)

Reference:

Example input:

```
Source: gentoo
Section: games
Priority: optional
Maintainer: Josip Rodin
Build-Depends: debhelper (>=10)
Homepage: https://packages.debian.org/gentoo

Package: gentoo
Architecture: any
Description: A nice game
 Gentoo is a classic Jumpn Run sidescrolling game.

```

Parsed result (first stanza):

```
[
    'source' => 'gentoo',
    'section' => 'games',
    'priority' => 'optional',
    'maintainer' => 'Josip Rodin ',
    'build-depends' => 'debhelper (>=10)',
    'homepage' => 'https://packages.debian.org/gentoo',
]
```

Key behaviors:

- Keys are normalized to lowercase
- Only the first `:` splits key from value
- Continuation lines (starting with whitespace) are appended to the previous field
- Blank lines separate stanzas
- Comment lines (starting with `#`) are skipped
- Throws `DcfParserException` on malformed input or file errors

Development
-----------

[](#development)

```
composer install
composer test        # Run tests
composer analyse     # PHPStan (level 8)
composer cs-fix      # Fix code style
composer cs-check    # Check code style
```

Credits
-------

[](#credits)

- [Dawid Makowski](https://github.com/makowskid)
- [Alin Purcaru](https://stackoverflow.com/users/321468/alin-purcaru) - thanks for inspiration on [StackOverflow](https://stackoverflow.com/questions/4392904/control-file-to-php-array)

License
-------

[](#license)

The MIT License (MIT). See the [License File](https://github.com/makowskid/dcfparser/blob/master/LICENSE) for more information.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance74

Regular maintenance activity

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~2274 days

Total

2

Last Release

148d ago

Major Versions

1.0.1 → 2.0.02026-02-05

PHP version history (2 changes)1.0.1PHP &gt;=5.4.0

2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b500dd3d9b470b50b1ed911cd24a6fdcce51dd97dceb4f97879f727a14495a8?d=identicon)[dawid-makowski](/maintainers/dawid-makowski)

---

Top Contributors

[![makowskid](https://avatars.githubusercontent.com/u/6271194?v=4)](https://github.com/makowskid "makowskid (10 commits)")

---

Tags

dcfdebianlaravelphpDCFdcfparser

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/makowskid-dcfparser/health.svg)

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

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19139.2M47](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9843.5k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

45153.1k6](/packages/jstewmc-rtf)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

113.2k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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