Installation
Requirements
Before installing Laravel Custom Field, make sure you have:
- PHP >= 8.0.1 (8.1+ recommended)
- Laravel >= 9.19 (9/10/11 supported)
- Composer
- jobmetric/laravel-package-core ^1.32
Install via Composer
Run the following command to pull in the latest version:
composer require jobmetric/laravel-custom-field
Service Provider
Laravel Package Auto-Discovery will automatically register the service provider. If you're using Laravel < 5.5 or have disabled auto-discovery, manually register the provider in config/app.php:
'providers' => [
// ...
JobMetric\CustomField\CustomFieldServiceProvider::class,
],
Publish Configuration
After installation, publish the configuration file (optional):
php artisan vendor:publish --provider="JobMetric\CustomField\CustomFieldServiceProvider" --tag="custom-field-config"
This will create a config/custom-field.php file where you can customize package settings.
Verify Installation
To verify the package is installed correctly, you can test building a field:
use JobMetric\CustomField\CustomFieldBuilder;
$field = CustomFieldBuilder::text()
->name('test')
->label('Test Field')
->build();
$html = $field->toHtml();
// If no errors occurred, installation is successful!
IDE Helpers
The package automatically generates IDE helpers after installation. These helpers provide autocomplete for field builders and methods.
If you need to regenerate IDE helpers manually:
php artisan custom-field:generate-ide-helpers
Next Steps
Now that you've installed Laravel Custom Field, you can:
- Learn about building fields
- Explore real-world examples
- Check out the complete API reference
Troubleshooting
Builder Methods Not Found
If you get "Method not found" errors:
- Make sure the package is properly installed via Composer
- Run
composer dump-autoload - Clear any opcode cache (OPcache) if enabled
- Regenerate IDE helpers:
php artisan custom-field:generate-ide-helpers
Views Not Found
If you get "View not found" errors:
- Make sure the service provider is registered
- Check that blade views are published (if using custom templates)
- Verify the package views are accessible
Assets Not Loading
If JavaScript or CSS assets aren't loading:
- Check that asset paths are correct
- Verify the
toHtml()method returns proper asset paths - Ensure assets are included in your layout