Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By php-dealv2.0.0MITIn 1 marketplace
Turns plain-language business rules into PHP code whose preconditions, postconditions and invariants are checked on every call, plus PHPUnit tests derived from them. Requires PHP 8.4 and the php-deal/framework library with a contract kernel started in your bootstrap.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
AI Design by Contract for PHP
Your AI agent turns business specifications into code that checks its own rules.
PhpDeal enforces those rules on every call, as native PHP attributes powered by Go! AOP.
You write the rules in plain language:
R1. A deposit is a positive amount.
R2. A deposit adds the amount to the balance.
R3. The balance is never negative.
Your agent turns them into contracts, the code and the tests:
use PhpDeal\Attribute\{Ensure, Invariant, Verify};
#[Invariant('$this->balance >= 0')] // R3
class Account
{
private float $balance = 0.0;
#[Verify('$amount > 0')] // R1
#[Ensure('$this->balance === $__old->balance + $amount')] // R2
public function deposit(float $amount): void
{
$this->balance += $amount;
}
}
When the code or its caller breaks a rule, PhpDeal stops the call and names the rule:
new Account()->deposit(-10);
// PhpDeal\Exception\PreconditionViolation:
// Precondition "$amount > 0" violated in Account->deposit(-10.0)
An AI agent writes code faster than anyone can review it. The hard question is no longer how to implement a feature but whether the code does what the business asked. The usual answers fall short:
Design by Contract closes that gap. Every business rule becomes an executable contract that lives next to the code it constrains:
#[Verify]) are what the caller must guarantee before a call.#[Ensure]) are what the method promises after it returns.#[Invariant]) are what is always true of an object between calls.PhpDeal checks them on every call. That gives each party something it lacked:
| For... | Contracts give you |
|---|---|
| You | A one-line, reviewable statement of each rule, traced to the specification, instead of hundreds of lines of code |
| The agent | An immediate, exact signal: which rule broke, in which method, with which arguments. It fixes the code instead of guessing |
| The tests | An oracle on every call. Any test that drives the object through valid calls also checks every postcondition and invariant |
| The next change | Rules that stay enforced. A later edit, by a person or an agent, can not quietly break one |
A broken contract is a bug, reported at the exact place where it happens, before a corrupt state travels through the application.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub php-deal/framework --plugin php-dealPlugins from other owners that cover similar ground