{"id":22160643,"url":"https://github.com/jpkleemans/htaccess-firewall","last_synced_at":"2025-03-24T15:22:46.353Z","repository":{"id":57002099,"uuid":"43206630","full_name":"jpkleemans/htaccess-firewall","owner":"jpkleemans","description":"Simple access control using Htaccess","archived":false,"fork":false,"pushed_at":"2017-03-22T17:22:10.000Z","size":47,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-29T20:35:35.194Z","etag":null,"topics":["allow","deny","firewall","htaccess"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpkleemans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-26T13:37:31.000Z","updated_at":"2023-05-12T16:42:46.000Z","dependencies_parsed_at":"2022-08-21T14:10:27.666Z","dependency_job_id":null,"html_url":"https://github.com/jpkleemans/htaccess-firewall","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpkleemans%2Fhtaccess-firewall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpkleemans%2Fhtaccess-firewall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpkleemans%2Fhtaccess-firewall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpkleemans%2Fhtaccess-firewall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpkleemans","download_url":"https://codeload.github.com/jpkleemans/htaccess-firewall/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245294889,"owners_count":20591938,"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","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":["allow","deny","firewall","htaccess"],"created_at":"2024-12-02T04:09:08.157Z","updated_at":"2025-03-24T15:22:46.327Z","avatar_url":"https://github.com/jpkleemans.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Htaccess Firewall\n\n[![Build Status](https://img.shields.io/travis/jpkleemans/htaccess-firewall.svg)](https://travis-ci.org/jpkleemans/htaccess-firewall)\n[![Code Quality](https://img.shields.io/scrutinizer/g/jpkleemans/htaccess-firewall.svg)](https://scrutinizer-ci.com/g/jpkleemans/htaccess-firewall/)\n[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md)\n\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/01ac1272-ec69-43ab-b918-bbed9898e073/big.png)](https://insight.sensiolabs.com/projects/01ac1272-ec69-43ab-b918-bbed9898e073)\n\nSimple access control using Htaccess.\n\n\u003e This library is currently under development. Things will change!\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require jpkleemans/htaccess-firewall:dev-master\n```\n\n## Usage\n\nFirst, create an instance of the `HtaccessFirewall\\HtaccessFirewall` class:\n\n``` php\n$firewall = new HtaccessFirewall('path/to/.htaccess');\n```\n\n### Block IP\n\n``` php\n$host = IP::fromString('123.0.0.1');\n\n$firewall-\u003edeny($host);\n```\n\n### Unblock IP\n\n``` php\n$host = IP::fromString('123.0.0.1');\n\n$firewall-\u003eundeny($host);\n```\n\n### Get all denied hosts\n\n``` php\n$hosts = $firewall-\u003egetDenied();\n```\n\n### Deactivate firewall (comment .htaccess lines)\n\n``` php\n$firewall-\u003edeactivate();\n\n// And to reactivate:\n$firewall-\u003ereactivate();\n```\n\n### Set 403 message\n\n``` php\n$hosts = $firewall-\u003eset403Message('You are blocked!');\n\n// And to remove:\n$hosts = $firewall-\u003eremove403Message();\n```\n\n## Use other filesystem\n\nYou can use another filesystem by passing it as the second argument of the `HtaccessFirewall` constructor.\nThe filesystem must implement the `HtaccessFirewall\\Filesystem\\Filesystem` interface.\n\n``` php\n$filesystem = new YourCustomFilesystem();\n$firewall = new HtaccessFirewall('path/to/.htaccess', $filesystem);\n```\n\n## Testing\n\n``` bash\n$ phpspec run\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpkleemans%2Fhtaccess-firewall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpkleemans%2Fhtaccess-firewall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpkleemans%2Fhtaccess-firewall/lists"}