symplify/rule-doc-generator-contracts
Contracts for Symplify’s rule doc generator: shared interfaces and value objects used to describe, format, and export rule documentation across Symplify tools. Useful when building custom rule providers, printers, or integrations without depending on full implementations.
Start by installing the package as a dev dependency: composer require --dev symplify/rule-doc-generator-contracts. Then, locate and implement the RuleDocumentationInterface in your custom rule classes — this is your primary entry point. As a Laravel developer, you’ll use this when building reusable StaticAnalysis or Rector-like tools for your codebase (e.g., internal coding standards enforcement), where consistent rule documentation is needed across projects. Your first step is to define basic metadata: rule title, description, and code examples.
Integrate by decorating your rule classes with RuleDocumentationInterface, then programmatically consume the metadata in CLI tools, Laravel commands, or documentation generators. For example:
php artisan docs:rules command that scans your app’s rules directory and renders HTML/Markdown docs.getDescription() output as inline IDE hints or hover tooltips in custom language servers.getInvalidCode()/getValidCode() to auto-generate before/after diffs in your CI reports or Confluence pages.
This pattern keeps your rule metadata executable — not just comments — enabling automated validation, searching, and filtering of rules in tooling ecosystems.instanceof RuleDocumentationInterface before consuming data.phpunit test that asserts getDescription() isn’t empty or contains a versioned changelog hint.symplify/rule-doc-generator) in production. Keep this dependency strictly in require-dev and isolated to doc-generation scripts.getDescription() for both CLI usage (php artisan rules) and user-facing docs — consistency reduces maintenance cost and improves adoption.How can I help you explore Laravel packages today?