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

Mago Laravel Package

carthage-software/mago

Mago is an extremely fast PHP linter, formatter, and static analyzer written in Rust. It brings Rust-inspired speed and reliability to PHP projects with a modern toolchain and great developer experience, plus multiple install options (script, Homebrew, Composer).

View on GitHub
Deep Wiki
Context7

title: The lexer & parser

Mago's lexer and parser 🧠

At the heart of Mago lies its high-performance, resilient lexer and parser. These are the foundational components that turn your raw PHP source code into a structured representation that all of Mago's other tools can understand.

  • The lexer (tokenizer) scans your code and breaks it down into a stream of individual "tokens" (e.g., OpenTag, LiteralString, Whitespace).
  • The parser takes the stream of tokens from the lexer and assembles them into a hierarchical Abstract Syntax Tree (AST) that represents the code's structure.

While these components are mostly used internally, Mago exposes them through the mago ast command. This is an incredibly powerful tool for:

  • Debugging complex parsing issues in your code.
  • Understanding exactly how PHP interprets a piece of syntax.
  • Integrating with other tools that need a robust PHP parser, delegating the hard work to Mago.

For Rust developers

If you're building your own tools in Rust and need a high-performance PHP parser, you can use Mago's core crates directly:

  • mago-syntax: the crate containing the lexer, parser, and all AST node definitions, along with utilities for working with the AST.
  • mago-names: the crate for resolving symbol names (e.g., turning a local class name into its fully qualified name).

Dive In

  • Usage: learn how to run the lexer and parser from the command line.
  • Command reference: a detailed guide to the mago ast command and its flags.
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
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
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