makowskid / dcfparser

DcfParser - 使用PHP解析Debian控制文件

1.0.1 2019-11-15 08:51 UTC

This package is auto-updated.

Last update: 2024-09-15 20:05:20 UTC


README

DcfParser 是一个用于解析Debian控制文件的PHP & Laravel扩展包。

DCF内容示例

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

解析结果

  ["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"
}

安装

软件要求
  • Git
  • Composer
安装步骤
  1. composer require makowskid/dcfparser
  2. composer install
  3. 运行测试 phpunit 确保一切正常

用法

在Laravel中

\DcfParser::parseFile('test.txt');

通用

$parser = new \makowskid\DcfParser\DcfParser();
$parser->parseFile('test.txt');

测试

要从项目文件夹运行测试,请执行以下命令。

bash
$ ./vendor/bin/phpunit

或者

$ composer test

鸣谢

许可

MIT许可(MIT)。有关更多信息,请参阅许可文件