{"id":15051155,"url":"https://github.com/makowskid/dcfparser","last_synced_at":"2026-02-23T07:03:07.237Z","repository":{"id":62522985,"uuid":"221837224","full_name":"makowskid/dcfparser","owner":"makowskid","description":"Debian Control Files (DCF) parser for PHP \u0026 Laravel package","archived":false,"fork":false,"pushed_at":"2019-11-15T08:56:24.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T14:41:26.546Z","etag":null,"topics":["dcf","debian","laravel","php"],"latest_commit_sha":null,"homepage":"https://www.debian.org/doc/debian-policy/ch-controlfields.html","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makowskid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-15T03:33:13.000Z","updated_at":"2023-12-01T06:49:44.000Z","dependencies_parsed_at":"2022-11-02T14:01:02.033Z","dependency_job_id":null,"html_url":"https://github.com/makowskid/dcfparser","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/makowskid/dcfparser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makowskid%2Fdcfparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makowskid%2Fdcfparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makowskid%2Fdcfparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makowskid%2Fdcfparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makowskid","download_url":"https://codeload.github.com/makowskid/dcfparser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makowskid%2Fdcfparser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29739024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T04:51:08.365Z","status":"ssl_error","status_checked_at":"2026-02-23T04:49:15.865Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dcf","debian","laravel","php"],"created_at":"2024-09-24T21:31:19.638Z","updated_at":"2026-02-23T07:03:07.231Z","avatar_url":"https://github.com/makowskid.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DcfParser\n\n**DcfParser** is a PHP \u0026 Laravel package to parse Debian Control Files (DCF format).\n\n## Requirements\n\n- PHP 8.2+\n\n## Installation\n\n```bash\ncomposer require makowskid/dcfparser\n```\n\n## Usage\n\n### Parse a file (first stanza)\n\n```php\n$parser = new \\makowskid\\DcfParser\\DcfParser();\n$data = $parser-\u003eparseFile('/path/to/control');\n// ['source' =\u003e 'gentoo', 'section' =\u003e 'games', ...]\n```\n\n### Parse a string\n\n```php\n$data = $parser-\u003eparseString(\"Source: gentoo\\nSection: games\\n\");\n```\n\n### Parse all stanzas\n\nDCF files can contain multiple stanzas (paragraphs) separated by blank lines:\n\n```php\n$stanzas = $parser-\u003eparseFileAll('/path/to/control');\n// or\n$stanzas = $parser-\u003eparseStringAll($content);\n\n// Returns: [['source' =\u003e 'gentoo', ...], ['package' =\u003e 'gentoo', ...]]\n```\n\n### Laravel\n\nThe package auto-discovers its service provider. Use the facade:\n\n```php\n\\DcfParser::parseFile('/path/to/control');\n\\DcfParser::parseString($content);\n\\DcfParser::parseFileAll('/path/to/control');\n\\DcfParser::parseStringAll($content);\n```\n\n## DCF Format\n\nReference: https://www.debian.org/doc/debian-policy/ch-controlfields.html\n\nExample input:\n```\nSource: gentoo\nSection: games\nPriority: optional\nMaintainer: Josip Rodin \u003cjoy-mg@debian.org\u003e\nBuild-Depends: debhelper (\u003e=10)\nHomepage: https://packages.debian.org/gentoo\n\nPackage: gentoo\nArchitecture: any\nDescription: A nice game\n Gentoo is a classic Jumpn Run sidescrolling game.\n```\n\nParsed result (first stanza):\n```php\n[\n    'source' =\u003e 'gentoo',\n    'section' =\u003e 'games',\n    'priority' =\u003e 'optional',\n    'maintainer' =\u003e 'Josip Rodin \u003cjoy-mg@debian.org\u003e',\n    'build-depends' =\u003e 'debhelper (\u003e=10)',\n    'homepage' =\u003e 'https://packages.debian.org/gentoo',\n]\n```\n\nKey behaviors:\n- Keys are normalized to lowercase\n- Only the first `:` splits key from value\n- Continuation lines (starting with whitespace) are appended to the previous field\n- Blank lines separate stanzas\n- Comment lines (starting with `#`) are skipped\n- Throws `DcfParserException` on malformed input or file errors\n\n## Development\n\n```bash\ncomposer install\ncomposer test        # Run tests\ncomposer analyse     # PHPStan (level 8)\ncomposer cs-fix      # Fix code style\ncomposer cs-check    # Check code style\n```\n\n## Credits\n\n- [Dawid Makowski](https://github.com/makowskid)\n- [Alin Purcaru](https://stackoverflow.com/users/321468/alin-purcaru) - thanks for inspiration on [StackOverflow](https://stackoverflow.com/questions/4392904/control-file-to-php-array)\n\n## License\n\nThe MIT License (MIT). See the [License File](https://github.com/makowskid/dcfparser/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakowskid%2Fdcfparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakowskid%2Fdcfparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakowskid%2Fdcfparser/lists"}