PHP code example of droath / hostsfile-manager

1. Go to this page and download the library: Download droath/hostsfile-manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

droath / hostsfile-manager example snippets




    $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();



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

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