Overview
TheFormsServiceProvider registers all services, components, views, translations, commands, and Blade directives for the Javaabu Forms package.
Namespace: Javaabu\Forms
Extends: Illuminate\Support\ServiceProvider
Class Definition
Methods
boot
- Publishing configuration, translations, and views
- Loading translations and views
- Registering Blade directives
- Registering component namespace
void
Publishes
When running in console mode, the following assets can be published: Configuration:config/config.php to config/forms.php
Translations:
lang/vendor/forms
Views:
resources/views/vendor/forms
Blade Directives
Registers two custom Blade directives: @model Directive:Component Namespace
Registers the component namespaceforms for all components in Javaabu\Forms\Views\Components:
register
- Merging configuration files
- Registering the
FormsDataBindersingleton - Registering the
formsmiddleware alias - Registering Artisan commands
void
Services Registered
FormsDataBinder Singleton:Commands Registered
When running in console mode:Javaabu\Forms\Commands\PublishViewCommandJavaabu\Forms\Commands\DiffViewsCommand
mergeConfig
frameworks configuration.
Returns: void
Configuration Merging:
-
Merges top-level config:
-
Deep merges each framework configuration:
Usage Example
Registering the Service Provider
In Laravel 11+, the service provider is auto-discovered. For older versions, add toconfig/app.php:
Publishing Assets
Using Registered Services
Access FormsDataBinder:Configuration Structure
The service provider expects a configuration file with the following structure:Registered Commands
The service provider registers two Artisan commands:- forms:publish-view - Publish specific view files for customization
- forms:diff-views - Compare published views with package views