makowskid / dcfparser
DcfParser - parse Debian Control Files with PHP
Installs: 624
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/makowskid/dcfparser
Requires
- php: >=5.4.0
Requires (Dev)
- mockery/mockery: >=0.9
- phpunit/phpunit: >=6.4
- symfony/var-dumper: >=2.0
This package is auto-updated.
Last update: 2025-10-15 22:41:14 UTC
README
DcfParser is a PHP & Laravel Package to parse Debian Control Files.
Example DCF contents:
Section: unknown
Priority: optional
Maintainer: Josip Rodin <joy-mg@debian.org>
Build-Depends: debhelper (>=10)
Standards-Version: 4.0.0
Homepage: <insert the upstream URL, if relevant>
Package: gentoo
Architecture: any
Depends: nothing
Description: The format for the package description is a short brief summary on the first line
 (after the Description field). The following lines should be used as a longer, more detailed description.
 Each line of the long description must be preceded by a space, and blank lines in the long description must contain a single ‘.’
 .
 following the preceding space.
Lastline: last
Parsing result:
  ["source"]=>
  string(6) "gentoo"
  ["section"]=>
  string(7) "unknown"
  ["priority"]=>
  string(8) "optional"
  ["maintainer"]=>
  string(31) "Josip Rodin <joy-mg@debian.org>"
  ["build-depends"]=>
  string(16) "debhelper (>=10)"
  ["standards-version"]=>
  string(5) "4.0.0"
  ["homepage"]=>
  string(38) "<insert the upstream URL, if relevant>"
  ["package"]=>
  string(6) "gentoo"
  ["architecture"]=>
  string(3) "any"
  ["depends"]=>
  string(7) "nothing"
  ["description"]=>
  string(353) "The format for the package description is a short brief summary on the first line (after the Description field). The following lines should be used as a longer, more detailed description. Each line of the long description must be preceded by a space, and blank lines in the long description must contain a single ‘.’ . following the preceding space."
  ["lastline"]=>
  string(3) "last"
}
Installation
Software Requirement
- Git
- Composer
Installation Steps
- composer require makowskid/dcfparser
- composer install
- make sure everything is OK by running the tests phpunit
Usage
In Laravel:
\DcfParser::parseFile('test.txt');
Generic:
$parser = new \makowskid\DcfParser\DcfParser();
$parser->parseFile('test.txt');
Test
To run the tests, run the following command from the project folder.
bash
$ ./vendor/bin/phpunit
or
$ composer test
Credits
- Dawid Makowski
- Alin Purcaru - thanks for inspiration on StackOverflow
License
The MIT License (MIT). See the License File for more information.