fduch / netrc
netrc 管理器
2.0.1
2019-07-08 12:19 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^7|^8
This package is not auto-updated.
Last update: 2024-09-14 15:21:50 UTC
README
简单的 netrc 文件管理器
安装
要将 netrc 管理器安装到您的项目中,请使用 composer
php composer.phar require fduch/netrc
用法
解析系统级或自定义 netrc 非常简单
<?php use Fduch\Netrc\Netrc; use Fduch\Netrc\Exception\ParseException; use Fduch\Netrc\Exception\FileNotFoundException; try { // you can specify path to netrc file as an argument of Netrc::parse() method $parsed = Netrc::parse(); // dumps key-value array corresponding to machine.one entry var_dump($parsed['machine.one']); } catch (FileNotFoundException $e) { // cannot locate readable netrc file } catch (ParseException $e) { // something is wrong with your netrc file }