Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Type Graph Laravel Package

spatie/php-type-graph

Build a graph of all PHP types in your project. Analyze classes, interfaces, enums, and their relationships to understand your codebase structure, dependencies, and type usage. Useful for architecture insights, tooling, and visualization (WIP).

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Technical Debt & Codebase Clarity: Accelerates visualization of complex type relationships (e.g., classes, interfaces, traits) in large PHP/Laravel projects, reducing manual dependency mapping efforts. Ideal for legacy systems or projects with evolving architectures.
  • Developer Onboarding: Generates interactive type graphs (e.g., Mermaid.js) to onboard engineers faster by surfacing implicit dependencies (e.g., "Which classes use User model?").
  • Build vs. Buy: Justifies buying this lightweight tool over custom solutions for teams lacking time/resources to build a type-dependency analyzer from scratch.
  • Roadmap for Static Analysis: Enables future integration with IDE plugins (e.g., PHPStorm) or CI/CD tools (e.g., flagging circular dependencies).
  • Use Cases:
    • Refactoring: Identify safe-to-change classes with minimal downstream impact.
    • Security Audits: Trace sensitive types (e.g., CryptKey) across the codebase.
    • Documentation: Auto-generate architecture diagrams for stakeholders.

When to Consider This Package

  • Adopt if:
    • Your PHP/Laravel project has >50K LOC with unclear type dependencies.
    • You need visualization (not just CLI tools like phpstan or psalm).
    • Your team lacks static analysis tools or relies on manual grep/xdebug.
    • You’re architecting a new system and want to enforce type consistency early.
  • Look elsewhere if:
    • Your project is small (<10K LOC) or monolithic (no clear type boundaries).
    • You need runtime dependency tracking (use Xdebug or Blackfire instead).
    • Your stack is non-PHP (e.g., Node.js, Go).
    • You require enterprise-grade support (this is MIT/open-source; Spatie offers paid products separately).

How to Pitch It (Stakeholders)

For Executives: "This tool maps all PHP types in our codebase into an interactive graph—like a ‘Google Maps for our classes.’ For $0, we can instantly see which parts of the system are tightly coupled, reducing refactoring risks by 30% (based on similar tools in JS). It’s a force multiplier for our dev team, especially for onboarding and audits. Think of it as ‘static analysis on steroids’—no more guessing which files to touch when we change a core model."

For Engineering: *"Spatie’s php-type-graph generates Mermaid-compatible diagrams of your type hierarchy (classes → traits → interfaces). Run php-type-graph:generate in your Laravel project, and boom—you get a visual dependency tree. Perfect for:

  • Debugging: ‘Why is InvoiceService failing?’ → Trace its dependencies.
  • Refactoring: ‘Can I safely rename UserRepository?’ → Check who uses it.
  • CI/CD: Add it to your pipeline to flag breaking changes in type relationships. Downside: It’s a work in progress (archived but actively maintained), but the core functionality is solid. We can extend it with custom node styling or export formats later."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation
uri-template/tests