PHPackages                             mchkhawarshahzad/php-htaccess-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. mchkhawarshahzad/php-htaccess-manager

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

mchkhawarshahzad/php-htaccess-manager
=====================================

PHP class to manage .htaccess files - parse, update, and merge rules easily.

v1.1.0(11mo ago)02MITPHPPHP &gt;=7.4

Since Jul 19Pushed 11mo agoCompare

[ Source](https://github.com/mchkhawarshahzad/php-htaccess-manager)[ Packagist](https://packagist.org/packages/mchkhawarshahzad/php-htaccess-manager)[ RSS](/packages/mchkhawarshahzad-php-htaccess-manager/feed)WikiDiscussions main Synced today

READMEChangelog (2)DependenciesVersions (4)Used By (0)

HtaccessManager
===============

[](#htaccessmanager)

A PHP class to read, parse, merge, and update `.htaccess` files in a structured way.

🔧 Features
----------

[](#-features)

- Parse existing `.htaccess` into nested blocks
- Merge new rules safely without duplicates
- Rebuild `.htaccess` content in proper structure
- Simple `get()` and `put()` file methods
- Auto-checks for disabled PHP functions
- Update `.htaccess` with new rules without affecting existing ones
- Apache rules validation and conversion on the fly based on apache version, if V2.2 then (2.4+ to 2.2) and if 2.4+ then (2.2 to 2.4+)

📂 Usage Examples (in `examples` folder)
---------------------------------------

[](#-usage-examples-in-examples-folder)

- `get` – Fetch raw `.htaccess` file data
- `put` – Save raw data to `.htaccess` file
- `generate` – Generate new `.htaccess` content using existing and new rules
- `update` – Merge new rules safely without duplication and update the file

### ✅ Example

[](#-example)

If installed via Composer, there's no need to include the file manually.

require\_once **DIR** . '/../src/Htaccess.php';

just use as

use HtaccessManager\\Htaccess;

$ht = new Htaccess();

For merge and update

$response = $ht-&gt;update("new rules array here");

For get raw content (New rules are optional)

$response = $ht-&gt;generate("New rules array here",".htaccess file path here");

📦 Installation
--------------

[](#-installation)

```
composer require mchkhawarshahzad/php-htaccess-manager
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance50

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

350d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/127604162?v=4)[mchkhawarshahzad](/maintainers/mchkhawarshahzad)[@mchkhawarshahzad](https://github.com/mchkhawarshahzad)

---

Top Contributors

[![mchkhawarshahzad](https://avatars.githubusercontent.com/u/127604162?v=4)](https://github.com/mchkhawarshahzad "mchkhawarshahzad (19 commits)")

---

Tags

phpparsermanagerrewriteapachehtaccess

### Embed Badge

![Health badge](/badges/mchkhawarshahzad-php-htaccess-manager/health.svg)

```
[![Health](https://phpackages.com/badges/mchkhawarshahzad-php-htaccess-manager/health.svg)](https://phpackages.com/packages/mchkhawarshahzad-php-htaccess-manager)
```

###  Alternatives

[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k960.0M160](/packages/doctrine-lexer)[simplehtmldom/simplehtmldom

A fast, simple and reliable HTML document parser for PHP.

1931.4M15](/packages/simplehtmldom-simplehtmldom)[romanpitak/nginx-config-processor

Nginx configuration files processor.

6935.9k1](/packages/romanpitak-nginx-config-processor)[corveda/php-sandbox

A PHP library that can be used to run PHP code in a sandboxed environment

23796.2k2](/packages/corveda-php-sandbox)[leonelquinteros/php-toml

PHP parser for TOML language ( https://github.com/toml-lang/toml )

286.9k](/packages/leonelquinteros-php-toml)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
