appstract/php-hostsfile

This package is abandoned and no longer maintained. No replacement package was suggested.

Read & Write Entries From the HostsFile with PHP

1.0.0 2018-01-22 15:02 UTC

This package is auto-updated.

Last update: 2022-06-14 16:52:36 UTC


README

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.