Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.
/ php-hostsfile Public archive

Read & Write HostsFile Entries with PHP

License

Notifications You must be signed in to change notification settings

appstract/php-hostsfile

Repository files navigation

PHP HostsFile

Latest Version on Packagist Total Downloads Software License

Read & Write Entries From the HostsFile with PHP.

Installation

You can install the package via composer:

composer require appstract/php-hostsfile

Usage

$host = new Appstract\HostsFile\Processor($path); // optional path to the file

$host->getLines(); // get all lines in the hostsfile
$host->addLine($ip, $domain, $aliases); // add a new line to the hostsfile
$host->set($ip, $domain, $aliases); // add a new line and overwrite any existing
$host->removeLine($domain); // remove a line from the hostsfile by domain
$host->save(); // save the changes to the hostsfile

Contributing

Contributions are welcome, thanks to y'all :)

About Appstract

Appstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on Medium. You can follow us on Twitter, buy us a beer or support us on Patreon.

License

The MIT License (MIT). Please see License File for more information.