PHPackages                             imageplus/claude-guardrails - 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. imageplus/claude-guardrails

ActiveComposer-plugin

imageplus/claude-guardrails
===========================

Claude Code guardrails for ImagePlus Laravel projects: permission deny rules + PreToolUse hooks that block Vapor commands, .env access and WordPress/Android config and credential files, and self-install into each project's .claude/settings.json.

1.0.0(today)02↑2900%MITPHPPHP &gt;=8.1

Since Jul 28Pushed todayCompare

[ Source](https://github.com/imageplus/claude-guardrails)[ Packagist](https://packagist.org/packages/imageplus/claude-guardrails)[ RSS](/packages/imageplus-claude-guardrails/feed)WikiDiscussions main Synced today

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

imageplus/claude-guardrails
===========================

[](#imageplusclaude-guardrails)

Centralised [Claude Code](https://code.claude.com) guardrails for ImagePlus Laravel projects.

Installing this package into a project automatically wires four protections into that project's `.claude/settings.json`:

1. **Vapor is blocked.** Claude cannot run any `vapor` command (deploy or otherwise). Deploys stay a manual, human-run action.
2. **`.env` is protected.** Claude cannot read, edit, copy or `source` a real `.env` file via its built-in tools or Bash. Template files (`.env.example`, `.env.sample`, `.env.dist`, `.env.template`) remain readable.
3. **WordPress credentials are protected.** `wp-config.php` and its per-environment variants (`wp-config-local.php`, `wp-config-staging.php`, and any other `wp-config-*.php`), `local-config.php`, `wp-salt.php`, `wp-cli.local.yml`, `~/.wp-cli/` and `.htpasswd` are off-limits — they carry DB credentials, auth salts and host aliases. `wp-config-sample.php` remains readable.
4. **Android secrets are protected.** `secrets.properties`, are off-limits. A project's own `gradle.properties`, `local.defaults.properties` and the Gradle build files stay readable.

Enforcement is layered: static `deny` rules as a first line, plus `PreToolUse`hooks (which block at exit code `2`, before permission rules are even evaluated) as the reliable line.

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

[](#installation)

This is a private, first-party package. Add your internal repository to the project's `composer.json`, then require it as a dev dependency:

```
composer require --dev imageplus/claude-guardrails
```

Because it is a Composer **plugin**, Composer 2.2+ will ask you to allow it to run. Approve it, or pre-approve it in the project's `composer.json`:

```
{
  "config": {
    "allow-plugins": {
      "imageplus/claude-guardrails": true
    }
  }
}
```

On the next `composer install` / `composer update`, the plugin merges its rules into `.claude/settings.json`, creating the file (and the `.claude/` directory) if they don't exist. Commit `.claude/settings.json` so every teammate inherits the same guardrails.

What lands in the project
-------------------------

[](#what-lands-in-the-project)

`.claude/settings.json` gains (merged, not overwritten):

```
{
  "permissions": {
    "deny": [
      "Bash(*vapor*)",
      "Read(.env)",
      "Read(**/.env)",
      "Write(.claude/**)",
      "Edit(.claude/**)",
      "Write(vendor/imageplus/claude-guardrails/**)",
      "Edit(vendor/imageplus/claude-guardrails/**)"
    ]
  },
  "hooks": {
    "PreToolUse": [
      { "matcher": "Bash", "hooks": [{ "type": "command", "command": "php $CLAUDE_PROJECT_DIR/vendor/imageplus/claude-guardrails/hooks/block-vapor.php" }] },
      { "matcher": "Read|Edit|Write|Bash", "hooks": [{ "type": "command", "command": "php $CLAUDE_PROJECT_DIR/vendor/imageplus/claude-guardrails/hooks/protect-env.php" }] }
    ]
  }
}
```

A sidecar file, `.claude/.guardrails-managed.json`, records which deny rules the package owns so it can keep them in sync on future updates. Leave it in place.

Updating
--------

[](#updating)

Bump the version and run `composer update imageplus/claude-guardrails` across your projects. The plugin re-syncs on every install/update: it strips the hook entries and deny rules it previously added and writes the current set, so changes here propagate everywhere without hand-editing any project.

Extending / changing what's blocked
-----------------------------------

[](#extending--changing-whats-blocked)

Edit `config/guardrails.json` in this package:

- **`deny`** — plain Claude Code permission strings. Use the `__PACKAGE_PATH__`token where you need this package's install path (the plugin substitutes the real relative path).
- **`hooks`** — each entry is `{ "matcher": "...", "script": "..." }`, where `script` is a file in `hooks/`. Add a new PHP hook file and reference it here.

Hook scripts read the tool-call JSON from stdin (`tool_name`, `tool_input.command`, `tool_input.file_path`) and exit `2` to block.

Verifying it works
------------------

[](#verifying-it-works)

In a project after install:

```
/permissions   # confirm the deny rules loaded
/hooks         # confirm both PreToolUse hooks are registered

```

Then ask Claude to run `./vendor/bin/vapor deploy production` (should block) and to `cat .env` (should block) versus `cat .env.example` (should succeed). On a WordPress project, `cat wp-config.php` should block while `cat wp-config-sample.php` succeeds.

Limitations (be honest about these)
-----------------------------------

[](#limitations-be-honest-about-these)

- Hooks can't see a filename that never appears in the command — e.g. `php artisan config:cache` reads `.env` internally. That doesn't expose the contents to Claude, so it's fine, but it means "no process ever touches .env" is not what this provides. For OS-level enforcement, use Claude Code's sandbox.
- Referenced scripts live in `vendor/`, which Claude *can* normally write to; that's why the package denies writes/edits to its own directory. If you want the scripts inside the already-protected `.claude/` dir instead, switch the plugin to copy them rather than reference them (you lose one-command updates).
- `deny` rules have a history of reliability bugs in Claude Code; the hooks are the dependable layer and the reason they exist.
- This package ships code that auto-executes in the dev loop. Keep it private and first-party, and review changes like any other security tooling.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance100

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6733ad87ac5b70e5e01b6a022e80475bec93eb8bef4c88d706807d46d4f9b672?d=identicon)[imageplus](/maintainers/imageplus)

---

Top Contributors

[![stevejones200](https://avatars.githubusercontent.com/u/6973666?v=4)](https://github.com/stevejones200 "stevejones200 (3 commits)")

---

Tags

laravelwordpressclaudeclaude-codevaporguardrails

### Embed Badge

![Health badge](/badges/imageplus-claude-guardrails/health.svg)

```
[![Health](https://phpackages.com/badges/imageplus-claude-guardrails/health.svg)](https://phpackages.com/packages/imageplus-claude-guardrails)
```

###  Alternatives

[composer/installers

A multi-framework Composer library installer

1.4k143.6M6.9k](/packages/composer-installers)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5345.4M571](/packages/drupal-core-composer-scaffold)[automattic/jetpack-autoloader

Creates a custom autoloader for a plugin or theme.

576.1M140](/packages/automattic-jetpack-autoloader)[drupal/core-project-message

Adds a message after Composer installation.

2124.7M205](/packages/drupal-core-project-message)[event4u/data-helpers

Framework-agnostic PHP library for data mapping, DTOs and utilities. Includes DataMapper, SimpleDto/LiteDto, DataAccessor/Mutator/Filter and helper classes (MathHelper, EnvHelper, etc.). Works with Laravel, Symfony/Doctrine or standalone PHP.

1431.1k](/packages/event4u-data-helpers)[altis/core

Core module for Altis

19228.0k4](/packages/altis-core)

PHPackages © 2026

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