PHPackages                             stardothosting/modsecurity-parser - 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. stardothosting/modsecurity-parser

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

stardothosting/modsecurity-parser
=================================

1:1 PHP port of msc\_pyparser (ModSecurity SecRule parser) with JSON output

v4.0.0(1y ago)1316↓50%[1 issues](https://github.com/stardothosting/modsecurity-php-rule-parser/issues)GPL-3.0-or-laterPHPPHP &gt;=7.4

Since Apr 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/stardothosting/modsecurity-php-rule-parser)[ Packagist](https://packagist.org/packages/stardothosting/modsecurity-parser)[ RSS](/packages/stardothosting-modsecurity-parser/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (43)Used By (0)

StardotHosting SecRule Parser
=============================

[](#stardothosting-secrule-parser)

[![Packagist Version](https://camo.githubusercontent.com/4e58fc5dca29569df02b9f8d22d81339f43264a15345cc4df9a7c422103af98b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73746172646f74686f7374696e672f73656372756c652d7061727365722e737667)](https://packagist.org/packages/stardothosting/secrule-parser)[![License](https://camo.githubusercontent.com/3ff06478e82c9cfa16ced13f780b396ce95ea5f9b059164a8ddf1bcf97ca7148/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73746172646f74686f7374696e672f73656372756c652d7061727365722e737667)](LICENSE)

A 1:1 PHP port of msc\_pyparser (ModSecurity SecRule parser) with JSON output.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Quick Start](#quick-start)
    - [As a Library](#as-a-library)
    - [From the CLI](#from-the-cli)
- [Usage](#usage)
    - [Parsing a Single File](#parsing-a-single-file)
    - [Parsing a Directory](#parsing-a-directory)
- [API Reference](#api-reference)
- [Contributing](#contributing)
- [License](#license)

---

Features
--------

[](#features)

- **Full fidelity** to the original Python implementation: all variables, operators, actions, quoting rules, chaining logic, and error reporting are preserved exactly.
- **JSON output** instead of YAML—no extra dependencies.
- **PSR-4** compliant, installable via Composer.
- **CLI tool** for rapid testing and integration in scripts or CI.

---

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- [psr/log](https://packagist.org/packages/psr/log) (optional, for logging)

---

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

[](#installation)

```
composer require stardothosting/secrule-parser
```

---

Quick Start
-----------

[](#quick-start)

### As a Library

[](#as-a-library)

```
