droath/hostsfile-manager
Composer 安装命令:
composer require droath/hostsfile-manager
包简介
Manage hosts file on nix based systems.
README 文档
README
Provides a class to add/remove lines from the hosts file. It has been tested to work on *nix based systems, otherwise you'll need to supply the path to the hosts file.
Getting Started
First, you'll need to download the hostsfile manager library using composer:
composer require droath/hostsfile-manager:^0.0.1
Examples
Add lines to the hosts file contents:
The below code appends two entries to the hosts file contents. If any of those lines already exists then nothing is appended.
<?php $hosts_file = (new \Droath\HostsFileManager\HostsFile()) ->setLine('127.0.0.1', 'local.sickslap.com') ->setLine('127.0.0.2', 'local.hiphopsmack.com'); (new \Droath\HostsFileManager\HostsFileWriter($hosts_file)) ->add();
Remove a single line from hosts file:
The below code removes the one entry from the hosts file. All other lines within the hosts file remain untouched.
<?php $hosts_file = (new \Droath\HostsFileManager\HostsFile()) ->setLine('127.0.0.2', 'local.hiphopsmack.com'); (new \Droath\HostsFileManager\HostsFileWriter($hosts_file)) ->remove();
统计信息
- 总下载量: 6.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-22