Skip to content

Wire Pulsar bootstrap and discovery

Pulsar restores only the Laravel discovery conventions that relocation breaks: Policies, Event Listeners, and Artisan Commands. Its installer patches recognized bootstrap safely; remaining relocated types resolve through normal Laravel container or dispatch paths.

Restore only relocated discovery

Pulsar install generates and registers PulsarServiceProvider, adds policy-name guessing, adds listener discovery for Domain listener directories, and expands Service Command directories before Laravel registers commands.
Wire Pulsar discovery through Laravel bootstrap. The installer restores only the discovery conventions relocation breaks; Services remain explicitly registered application wiring.

Interpretation. The installer restores policy, [Listener](/concepts/listener), and [Command](/concepts/command) discovery only. A [Service](/concepts/service) provider remains an explicit application registration; `pulsar install` does not install it.

ConcernPulsar wiringLimit
PoliciesPulsarServiceProvider configures policy-name guessing from Domain/{Domain}/Models to Domain/{Domain}/Policies.This does not authorize an action or claim a universal mapping.
ListenerswithEvents(discover: [app_path('Pulsar/Domain/*/Listeners')]) lets Laravel discover the relocated Listener directories.The checked fixture proves one recognized bootstrap shape and one Listener.
Commandsglob(..., GLOB_ONLYDIR) expands Service Command directories before withCommands receives them.withCommands is not given a literal wildcard.
Service providersmake:service prints the provider class for bootstrap/providers.php.Application wiring stays explicit and separate.

Patch bootstrap safely

The installer plans and validates all writes before changing a file. A dry run prints the planned diff and writes nothing. A normal first run creates the next bootstrap/app.php.pulsar.bak; a normal rerun is a no-op. --force restores only a changed generated PulsarServiceProvider while preserving existing wiring, not a general overwrite flag.

Unsupported chains, malformed delimiters, duplicate discovery calls, and unsafe merge shapes fail before writes and direct the reader to manual calls. That fail-closed behavior is limited to installer mutations. It does not validate manually authored bootstrap, cache, or deployment configuration.

Context: bounded bootstrap shape — Command glob results, rather than the wildcard, are passed to Laravel.

php
Application::configure(basePath: dirname(__DIR__))
    ->withEvents(discover: [app_path('Pulsar/Domain/*/Listeners')])
    ->withCommands([...(glob(app_path('Pulsar/Services/*/Modules/*/Commands'), GLOB_ONLYDIR) ?: [])]);

Leave ordinary Laravel resolution alone

Jobs, middleware, bindings, Requests, Resources, route-model binding, Notifications, and Mailables do not receive installer discovery. They resolve through PSR-4, the container, routing, or dispatch as Laravel normally does. This page does not prescribe bootstrap caches, deployment operations, or a cache-clear workflow.

Use Contracts and Adapters for provider binding choices, Listeners for reaction behavior, and Bootstrap Wiring for the existing application walkthrough.