A command-line tool for working with HAR (HTTP Archive) files.
- cat - Output HAR file contents, optionally filtered
- requests - List all requests with their indices
- view - View full details of a specific request
Download a standalone executable from the Releases page. No PHP installation required.
# Download the latest release (Linux x86_64)
curl -LO https://github.com/linkorb/harphp/releases/latest/download/harphp-linux-x86_64
chmod +x harphp-linux-x86_64
# Move to PATH (optional)
sudo mv harphp-linux-x86_64 /usr/local/bin/harphpAvailable binaries:
| Platform | Binary | Description |
|---|---|---|
| Linux x86_64 | harphp-linux-x86_64 |
Fully static (musl), most portable |
| Linux ARM64 | harphp-linux-aarch64 |
Fully static (musl), for ARM64/aarch64 |
composer install
chmod +x bin/harphpNote: If using the standalone binary, replace
bin/harphpwith:./harphp-linux-x86_64 php-cli /app/bin/harphp
bin/harphp requests capture.harOutput:
0 │ GET │ 200 │ 45.23ms │ https://example.com/
1 │ GET │ 200 │ 12.10ms │ https://example.com/style.css
2 │ POST │ 201 │ 120.50ms │ https://api.example.com/users
...
# View request at index 0
bin/harphp view capture.har 0
# Output as JSON
bin/harphp view capture.har 0 --json
# Include request and response bodies
bin/harphp view capture.har 0 --request-body --response-body# Output filtered HAR to stdout (reads harphp.yaml from cwd if present)
bin/harphp cat capture.har
# Output compact JSON
bin/harphp cat capture.har --compact
# Use a specific config file
bin/harphp cat capture.har --config=myconfig.yaml
# Save filtered HAR to file
bin/harphp cat capture.har -o filtered.harBy default, harphp looks for harphp.yaml in:
- Current working directory
- The directory containing
bin/harphp
You can specify a different config file with --config=path/to/config.yaml.
Create a configuration file to include or exclude requests based on:
- domains - Match request host/domain
- paths - Match request URL path
- extensions - Match file extensions
- urls - Match full URL
Patterns support:
- Glob patterns:
*.jpg,api/*,**/images/** - Regular expressions:
/pattern/flagsor#pattern#flags
Example harphp.yaml:
filters:
ignore:
domains:
- "*.google-analytics.com"
- "fonts.googleapis.com"
paths:
- "/analytics/*"
- "*/pixel.gif"
extensions:
- jpg
- png
- gif
- woff2
urls:
- "*utm_source=*"
- "/.*\\/api\\/health\\/?$/i"Whitelist mode (only include matching requests):
filters:
include:
domains:
- "api.example.com"
paths:
- "/api/**"You can also set the config file path via environment variable in .env.local:
HARPHP_FILTER=path/to/config.yamlThis is only used as a fallback if no harphp.yaml is found in cwd or base directory.
Usage:
cat [options] <file>
Arguments:
file Path to HAR file
Options:
-c, --config=CONFIG Path to config YAML file (default: harphp.yaml)
--compact Output compact JSON (default: pretty-printed)
-o, --output=OUTPUT Output file path (default: stdout)
Usage:
requests [options] <file>
Arguments:
file Path to HAR file
Options:
-c, --config=CONFIG Path to config YAML file (default: harphp.yaml)
Usage:
view [options] <file> <index>
Arguments:
file Path to HAR file
index Request index to view
Options:
-c, --config=CONFIG Path to config YAML file (default: harphp.yaml)
-j, --json Output raw JSON
--request-body Show request body
--response-body Show response body
harphp can be compiled into a fully standalone executable using FrankenPHP. The resulting binary includes the PHP runtime and all dependencies, requiring no external PHP installation.
- Docker (for building)
# Build for your current platform (Linux musl - fully static)
./build.sh
# Build with glibc (for dynamic extension support)
LIBC=gnu ./build.sh
# Cross-compile for different architectures
TARGET_ARCH=aarch64 ./build.sh # ARM64
TARGET_ARCH=x86_64 ./build.sh # x86_64After building, the executable is available at dist/harphp:
# Run commands using the embedded PHP CLI
./dist/harphp php-cli /app/bin/harphp requests capture.har
./dist/harphp php-cli /app/bin/harphp view capture.har 0
./dist/harphp php-cli /app/bin/harphp cat capture.har -o filtered.har| Environment Variable | Description | Default |
|---|---|---|
LIBC |
C library variant: musl (static) or gnu (dynamic) |
musl |
TARGET_OS |
Target OS: linux or mac |
Current OS |
TARGET_ARCH |
Target architecture: x86_64 or aarch64 |
Current arch |
The standalone binary is approximately 30-50MB depending on included extensions. For production deployment, you can further reduce size using UPX compression:
upx --best dist/harphpThis project uses Conventional Commits for automatic versioning and changelog generation.
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
| Type | Description | Version Bump |
|---|---|---|
feat |
New feature | Minor (0.x.0) |
fix |
Bug fix | Patch (0.0.x) |
docs |
Documentation only | None |
style |
Code style (formatting) | None |
refactor |
Code refactoring | None |
perf |
Performance improvement | Patch |
test |
Adding tests | None |
chore |
Maintenance tasks | None |
ci |
CI/CD changes | None |
Add ! after the type or include BREAKING CHANGE: in the footer for major version bumps:
feat!: remove deprecated filter syntax
BREAKING CHANGE: The old filter syntax is no longer supported.
# Feature (minor version bump)
git commit -m "feat: add JSON output format for requests command"
# Bug fix (patch version bump)
git commit -m "fix: handle empty HAR files gracefully"
# Breaking change (major version bump)
git commit -m "feat!: change default output format to compact JSON"Releases are automated via GitHub Actions:
- Push commits to
mainusing conventional commit messages - Release Please creates/updates a release PR with changelog
- Merge the release PR to trigger:
- Version bump in
composer.jsonandsrc/Application.php - Git tag creation
- GitHub release with binaries attached
- Version bump in
MIT