PHPackages                             droath/hostsfile-manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. droath/hostsfile-manager

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

droath/hostsfile-manager
========================

Manage hosts file on nix based systems.

0.0.1(9y ago)06.4kMITPHPPHP &gt;=5.4

Since Mar 22Pushed 9y agoCompare

[ Source](https://github.com/droath/hostsfile-manager)[ Packagist](https://packagist.org/packages/droath/hostsfile-manager)[ RSS](/packages/droath-hostsfile-manager/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (1)Used By (0)

Hosts File Manager
==================

[](#hosts-file-manager)

[![Build Status](https://camo.githubusercontent.com/4da812ebae97b40e056f5bf84895d1251ad41f785fa27926b30089506fc24e82/68747470733a2f2f7472617669732d63692e6f72672f64726f6174682f686f73747366696c652d6d616e616765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/droath/hostsfile-manager)

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
---------------

[](#getting-started)

First, you'll need to download the hostsfile manager library using composer:

```
composer require droath/hostsfile-manager:^0.0.1
```

Examples
--------

[](#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.

```
