PHPackages                             liquidweb/htaccess-validator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. liquidweb/htaccess-validator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

liquidweb/htaccess-validator
============================

Lint and validate Apache2 Htaccess files

v0.2.0(5y ago)450.0k↓100%[1 issues](https://github.com/liquidweb/htaccess-validator-php/issues)MITPHPPHP ^5.6||^7.0||^8.0

Since Mar 5Pushed 5y ago10 watchersCompare

[ Source](https://github.com/liquidweb/htaccess-validator-php)[ Packagist](https://packagist.org/packages/liquidweb/htaccess-validator)[ RSS](/packages/liquidweb-htaccess-validator/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Htaccess Validator (Composer Package)
=====================================

[](#htaccess-validator-composer-package)

This is a Composer package wrapper for [Liquid Web's Htaccess Validator script](https://github.com/liquidweb/htaccess-validator), enabling PHP applications to easily validate Htaccess files.

Installation
------------

[](#installation)

The easiest way to install the package is via [Composer](https://getcomposer.org):

```
$ composer require liquidweb/htaccess-validator

```

As the package uses Apache2 itself to validate, it must be available within your environment. [The Liquid Web Knowledge Base has instructions for installing Apache on most popular platforms](https://www.liquidweb.com/kb/install-apache-2-ubuntu-18-04/).

Usage
-----

[](#usage)

There are two main ways to use the validator:

1. As a stand-alone tool via the command line
2. As a PHP library (requires `proc_open` to be available)

### Validating Apache2 configurations from the command line interface (CLI)

[](#validating-apache2-configurations-from-the-command-line-interface-cli)

The `bin/validate-htaccess` script accepts a configuration file for validation:

```
$ bin/validate-htaccess /path/to/some/file.conf
```

The script will return a non-zero exit code if validation errors were detected. [Individual codes are documented in the script's header](https://github.com/liquidweb/htaccess-validator/blob/develop/bin/validate-htaccess#L15).

### Validating Apache2 configurations within a PHP script

[](#validating-apache2-configurations-within-a-php-script)

The `LiquidWeb\HtaccessValidator\Validator` class serves as a wrapper around the `bin/validate-htaccess` script, enabling applications to validate Apache2 configurations programmatically.

There are two ways to instantiate the class:

1. Passing the full system path of the file under validation to the class constructor:

    ```
    use LiquidWeb\HtaccessValidator\Validator;

    $validator = new Validator($file);
    ```
2. Passing the configuration directly to the `::createFromString()` factory method:

    ```
    use LiquidWeb\HtaccessValidator\Validator;

    $validator = Validator::createFromString('Options +FollowSymLinks');
    ```

Once you have a Validator instance, you may validate it in two ways:

```
# Throws a LiquidWeb\HtaccessValidator\Exceptions\ValidationException upon failure.
$validator->validate();

# Return a boolean.
$validator->isValid();
```

#### Modifying the path to the validator shell script

[](#modifying-the-path-to-the-validator-shell-script)

By default, the library assumes that the `validate-htaccess` shell script lives in `vendor/bin/`.

If you're using a non-standard Composer configuration, you can explicitly specify the path by setting the `HTACCESS_VALIDATOR_SCRIPT` environment variable, either in your environment configuration or inline:

```
# Absolute system path to the shell script.
putenv('HTACCESS_VALIDATOR_SCRIPT=/some/path/to/vendor/bin/htaccess-validator');

# Will now use the Htaccess Validator script specified above.
$validator = (new Validator($file))->validate();
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.3% 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 ~3 days

Total

2

Last Release

1888d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/05f4d610f0de13ac1c23825f691fd05f2dd37ae9e8f0483e2dc4f1ca1e2bfb32?d=identicon)[stevegrunwell](/maintainers/stevegrunwell)

![](https://www.gravatar.com/avatar/ad03381f7bd6204bcd73e5d6f4a3e6651664ccfe78af6ec49e48e9e2a8ca3f93?d=identicon)[bswatson](/maintainers/bswatson)

![](https://www.gravatar.com/avatar/ddc28240a5a5ddcabc25aecb2bb12ebf06482fdf553dad28aa15e31958ee3b64?d=identicon)[liquidweb](/maintainers/liquidweb)

---

Top Contributors

[![stevegrunwell](https://avatars.githubusercontent.com/u/233836?v=4)](https://github.com/stevegrunwell "stevegrunwell (13 commits)")[![bswatson](https://avatars.githubusercontent.com/u/303029?v=4)](https://github.com/bswatson "bswatson (3 commits)")

### Embed Badge

![Health badge](/badges/liquidweb-htaccess-validator/health.svg)

```
[![Health](https://phpackages.com/badges/liquidweb-htaccess-validator/health.svg)](https://phpackages.com/packages/liquidweb-htaccess-validator)
```

###  Alternatives

[robole/sulu-ai-translator-bundle

Translate any type of content using DeepL

181.3k](/packages/robole-sulu-ai-translator-bundle)

PHPackages © 2026

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