Skip to content

View Composers ​

Directory: src/Http/ViewComposers/

View composers are classes that bind data to every view (or Inertia response) before it is rendered. Modularous registers them automatically in BaseServiceProvider. They inject cross-cutting data — the authenticated user, active navigation state, upload configuration, locale settings, and common URLs — so controllers never have to pass this data manually.

Composers ​

ComposerVariable injectedDescription
ActiveNavigation_global_active_navigation, _primary_active_navigation, _secondary_active_navigationParses the current route name into navigation depth markers
CurrentUsercurrentUserInjects the authenticated user profile using Modularous auth guard
FilesUploaderConfigfilesUploaderConfigBuilds the file-library upload configuration object (endpoint, CSRF, ACL, limits)
LocalizationmodularousLocalizationInjects the full locale/language configuration for frontend i18n
MediasUploaderConfigmediasUploaderConfigBuilds the media-library upload configuration object (endpoint, CSRF, ACL, limits)
UrlsurlsInjects commonly used admin route URLs (profile show/update)

Registration ​

All composers are bound in BaseServiceProvider::registerViewComposers(). They run on every request that renders a view, so the injected variables are always available in Blade templates and Inertia shared props without any controller boilerplate.