AboutCommand::add(), you can add a section for your package to the output of php artisan about without implementing a dedicated command.
The official documentation includes a basic registration example. This page goes further by examining the Laravel 13 implementation, covering when information is collected, JSON types, section name collisions, and registration state in tests.
Register the displayed content in your provider
The following example assumes thatcourier.enabled and courier.driver are already registered as package configuration. For how to register configuration, see Package config merging and caching.
runningInConsole() is a condition that avoids unnecessary registration during HTTP requests. It does not detect only when about is running, so the registration also happens for other Artisan commands. However, the configuration lookups inside the closure above are not executed at registration time.
Think about registration and evaluation timing separately
In Laravelv13.35.0, add() does not collect data immediately. Instead, it appends a registration closure to the static $customDataResolvers. When about runs, it builds the display data and evaluates the registered data-retrieval closures.
Reading configuration values inside the closure reflects the state at command execution time better than reading them outside add() beforehand and fixing them in an array. On the other hand, the --only filter is applied after the data-retrieval closures are evaluated.
Acme Courier closure above is still evaluated. Not being displayed is not the same as not being processed.
For this reason, collect the added information from configuration values or lightweight local state. If you include connectivity checks against external APIs, database queries, or file modifications, even commands that inspect unrelated sections may become slow or fail. Move connectivity checks and repairs into dedicated Artisan commands.
Support both CLI display and JSON types
To check only your package’s information, pass the section name converted to lowercase snake case. ForAcme Courier, this is acme_courier.
courier.enabled is true and courier.driver is log, the JSON looks like this:
Enabled is shown as ENABLED. AboutCommand::format() is a helper that lets you specify console for the CLI and json for JSON. The example above specifies only console, so JSON returns the original boolean value. There is no need to reuse the CLI display string in JSON.
Using names made of ordinary English words separated by spaces, as in the example, makes filters and JSON keys easier to work with. Keys referenced by automated processes may change when display names change, so check compatibility at release time.
Give your section a package-specific name
add() appends items to the same section. Specifying a section with the same name does not replace everything that was registered earlier.
Choose a name like Acme Courier that distinguishes your package from others, and add to Laravel’s built-in Environment, Cache, Drivers, and Storage sections only when necessary.
If you register the same item name more than once in the same section, the CLI may keep it as multiple lines, but JSON merges them into the same key and keeps the later value. Also avoid names that are written differently but become the same key after conversion to snake case. Keep registration in one place and design items to be unique in both CLI and JSON output.
Handle static registration state in tests
The display$data is reset when about starts running, but the registration list for added information, $customDataResolvers, is retained. This lets the command recollect information from the same registrations every time, but if a provider’s boot() runs repeatedly within the same PHP process, registrations may accumulate.
AboutCommand::flushState() is a method that clears registrations from all packages as well as the display data. Do not call it in a production provider to avoid duplicating your own section. Doing so also discards other packages’ diagnostics.
If you rebuild the application in your own test infrastructure, decide who is responsible for resetting state between tests. If you reset it, do so before booting the target providers, and then perform all necessary registrations. Also check whether your existing test infrastructure already resets the state.
Pre-release checklist
Check the following combinations in Testing Laravel packages with Orchestra Testbench and in a real application that uses your package.Related pages
Laravel Package Development
Review the basics of providers and resource registration.
Package config merging and caching
Review how defaults, user overrides, and the configuration cache relate to each other.
Primary sources
- Laravel official documentation: Adding information from packages to about
- Laravel official documentation: about and —only
- Laravel Framework v13.35.0: AboutCommand: registration, evaluation order, key conversion,
format(), andflushState(). - Laravel Framework v13.35.0: format tests
- Laravel Framework v13.35.0: JSON output integration tests