2017 © Pedro Peláez
 

library hostsfile-manager

Manage hosts file on nix based systems.

image

droath/hostsfile-manager

Manage hosts file on nix based systems.

  • Wednesday, March 22, 2017
  • by droath
  • Repository
  • 0 Watchers
  • 0 Stars
  • 5,335 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 12 % Grown

The README.md

Hosts File Manager

Build Status, (*1)

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., (*2)

Getting Started

First, you'll need to download the hostsfile manager library using composer:, (*3)

composer require droath/hostsfile-manager:^0.0.1

Examples

Add lines to the hosts file contents:, (*4)

The below code appends two entries to the hosts file contents. If any of those lines already exists then nothing is appended., (*5)

<?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:, (*6)

The below code removes the one entry from the hosts file. All other lines within the hosts file remain untouched., (*7)

<?php

    $hosts_file = (new \Droath\HostsFileManager\HostsFile())
        ->setLine('127.0.0.2', 'local.hiphopsmack.com');

    (new \Droath\HostsFileManager\HostsFileWriter($hosts_file))
        ->remove();

The Versions

22/03 2017

dev-master

9999999-dev

Manage hosts file on nix based systems.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Travis Tomka

22/03 2017

0.0.1

0.0.1.0

Manage hosts file on nix based systems.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Travis Tomka