{"id":19615430,"url":"https://github.com/droath/hostsfile-manager","last_synced_at":"2025-08-02T00:09:12.085Z","repository":{"id":56972284,"uuid":"85773191","full_name":"droath/hostsfile-manager","owner":"droath","description":"Manage the system hosts file using PHP.","archived":false,"fork":false,"pushed_at":"2017-03-22T15:06:51.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-26T17:48:39.767Z","etag":null,"topics":["hosts","hostsfile","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/droath.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-22T01:54:06.000Z","updated_at":"2017-03-22T15:00:19.000Z","dependencies_parsed_at":"2022-08-21T07:10:26.869Z","dependency_job_id":null,"html_url":"https://github.com/droath/hostsfile-manager","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/droath/hostsfile-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droath%2Fhostsfile-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droath%2Fhostsfile-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droath%2Fhostsfile-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droath%2Fhostsfile-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/droath","download_url":"https://codeload.github.com/droath/hostsfile-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droath%2Fhostsfile-manager/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268315957,"owners_count":24231061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hosts","hostsfile","php"],"created_at":"2024-11-11T10:56:47.090Z","updated_at":"2025-08-02T00:09:11.991Z","avatar_url":"https://github.com/droath.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hosts File Manager\n\n[![Build Status](https://travis-ci.org/droath/hostsfile-manager.svg?branch=master)](https://travis-ci.org/droath/hostsfile-manager)\n\nProvides 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.\n\n\n## Getting Started\n\nFirst, you'll need to download the hostsfile manager library using composer:\n\n```bash\ncomposer require droath/hostsfile-manager:^0.0.1\n```\n\n## Examples\n\n**Add lines to the hosts file contents:**\n\nThe below code appends two entries to the hosts file contents. If any of those lines already exists then nothing is appended.\n\n```php\n\u003c?php\n\n    $hosts_file = (new \\Droath\\HostsFileManager\\HostsFile())\n        -\u003esetLine('127.0.0.1', 'local.sickslap.com')\n        -\u003esetLine('127.0.0.2', 'local.hiphopsmack.com');\n\n    (new \\Droath\\HostsFileManager\\HostsFileWriter($hosts_file))\n        -\u003eadd();\n```\n\n\n**Remove a single line from hosts file:**\n\nThe below code removes the one entry from the hosts file. All other lines within the hosts file remain untouched.\n\n```php\n\u003c?php\n\n    $hosts_file = (new \\Droath\\HostsFileManager\\HostsFile())\n        -\u003esetLine('127.0.0.2', 'local.hiphopsmack.com');\n\n    (new \\Droath\\HostsFileManager\\HostsFileWriter($hosts_file))\n        -\u003eremove();\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdroath%2Fhostsfile-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdroath%2Fhostsfile-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdroath%2Fhostsfile-manager/lists"}