Weave 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 Signature Parser

Php Signature Parser Laravel Package

andydefer/php-signature-parser

A strict, typed parser for CLI signatures that extracts the command source, required and default arguments, nullables, variadics, enums, and flags using value objects and typed collections, with ^ spacing, inline comments, special tokens, and custom tags.

View on GitHub
Deep Wiki
Context7

A flexible signature parser for CLI commands

Frequently asked questions about Php Signature Parser
What is andydefer/php-signature-parser used for?
It is a standalone PHP 8.1+ library that parses Laravel/Artisan-style command signature strings into typed value objects and collections. It extracts the command source, required arguments, default arguments, nullables, variadics, enums, and flags. Its best fit is developer tooling such as signature linters, command documentation generators, scaffolding, and static analysis rules, not the CLI runtime path.
How do I install php-signature-parser in a Laravel project?
Install it with Composer using composer require andydefer/php-signature-parser. It has no evident framework coupling and requires PHP 8.1 or higher. Given the unproven release history, pin an exact version rather than using a caret range.
Does php-signature-parser work with Laravel 10, 11, and 12?
It is a framework-agnostic PHP 8.1+ package, so it can be installed in Laravel 10, 11, and 12 projects as a dev dependency. It does not integrate with Laravel's console kernel by itself; you need your own adapter if you want runtime-facing behavior. Start with read-only tooling rather than replacing Laravel's console parser.
Is php-signature-parser a replacement for Laravel's Illuminate\Console\Parser?
No. Laravel's parser produces Symfony Console InputArgument and InputOption objects used during command registration, while this package produces its own value object graph. It does not drop in as a replacement for Illuminate\Console\Parser. You would need an adapter mapping SignatureStructureVO to Symfony InputDefinition for runtime use.
Can I use php-signature-parser at runtime in an Artisan command?
You can, but it is not recommended without a proven adapter and differential test coverage against Laravel's own parser. The package is positioned as a parser and metadata extractor, not a console runtime. Keep it behind an internal interface and use it first for documentation, linting, or command inventory.
What are the ^ spacing, inline comments, and custom tags in php-signature-parser signatures?
The package supports a superset syntax including the ^ character for automatic whitespace formatting, inline comments, the ? null token, the _ skip token, and custom tags. These extensions are useful for tooling and richer metadata extraction. They are not valid Artisan signature syntax, so signatures written for this parser must not be used directly as production Artisan signatures without normalization.
Does php-signature-parser support enums in command signatures?
Yes. It extracts enum information into an EnumCollection as part of its typed object graph, which is a genuine value-add for documentation and tooling. Symfony Console InputDefinition cannot express enums natively. If you need runtime validation or shell suggestions for enums, you must build and own that validation layer.
Is there a Symfony InputDefinition adapter for php-signature-parser?
The provided context does not indicate an existing Symfony InputDefinition adapter. You will likely need to write the mapping from SignatureStructureVO, ArgumentCollection, and FlagCollection to Symfony InputDefinition yourself. That adapter is also where subtle differences around default values, array options, and optional-value flags will surface.
Is php-signature-parser production-ready and actively maintained?
Treat it as pre-1.0. The evaluation notes zero stars, zero dependents, a single author, French-language documentation, and no visible CI, test suite, changelog, or semantic versioning policy in the excerpt. Pin exact versions and validate behavior against the real Artisan grammar before relying on it for important tooling.
How does php-signature-parser handle variadics, nullable arguments, and default values?
It parses variadics into a VariadicArgumentCollection and represents nullable and default arguments through its value objects and typed collections. The README shows examples such as {excludes*}, {purpose*}, {format=zip}, and {env=?}. Because the package uses its own object graph, you must map those values correctly if you translate them to Symfony Console definitions.
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.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast