Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.x] Add --json option to EventListCommand #55207

Conversation

hotsaucejake
Copy link
Contributor

Summary
This pull request adds an optional --json flag to the event:list command so that it can return events and listeners in JSON format, similar to other Laravel commands like route:list, about, model:show, and db:table.

  • Brings event:list into parity with other Artisan commands that provide both traditional CLI output and a JSON option.
  • Introduces a --json flag to output the event/listener data as JSON.
  • Preserves all existing CLI output and behavior.
  • Non-breaking change: all existing tests pass unchanged, while new tests ensure the JSON output works correctly.

Future
There are other commands that could similarly use an optional --json flag, such as ListFailedCommand, ConfigShowCommand, ChannelListCommand, and ScheduleListCommand. I can make separate pull requests for these.

Testing

  • Existing tests for event:list remain unmodified and still pass.
  • Added new coverage to verify JSON output, including cases for an empty list, a populated list, and usage with filters.

@hotsaucejake hotsaucejake changed the title Add --json option to EventListCommand [12.x] Add --json option to EventListCommand Mar 30, 2025
@taylorotwell taylorotwell merged commit 191cd91 into laravel:12.x Apr 1, 2025
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants