š¤ sarcastic summary with hashtags
Formello: The Laravel Package for Creating Forms, Simplified & Lightweight š
- Simpler than complex form libraries š ļø
- Lighter than full-featured admin panels like Nova or Filament š ļø
Formello makes the process of creating repetitive forms in Laravel a breeze. It offers a comprehensive solution with features that cater to developers’ every need, making it a must-have for Laravel users.
š Key Features
-
Easy-to-use form definition using Laravel classes
-
Automatic rendering directly to Blade
-
Supports various fields: text, textarea, select, select2, radio, checkbox, toggle, date, datetime, upload, hidden, and custom widgets
-
Automatic error handling, no need to create manually
- <
Formello: A Practical Solution for Creating Forms in Laravel š
If you frequently code in Laravel, youāve probably experienced the hassle of creating repetitive forms. From creating input fields, validation, error handling, to rendering in Blade. Well, now thereās Formello, a Laravel package specifically designed to simplify developersā lives when creating forms.Formello offers the perfect compromise:
-
Simpler than complex form libraries.
-
Lighter than full-featured admin panels such as Nova or Filament.
So, if you need to create forms quickly but still want them to be flexible and easy to manage, Formello could be your new best friend.
⨠Key Features of Formello
-
Easy-to-use form definition using Laravel classes.
-
Automatic rendering directly to Blade.
-
Supports various fields: text, textarea, select, select2, radio, checkbox, toggle, date, datetime, upload, hidden, and custom widgets.
-
Automatic error handling (no need to create manually).
-
Form validation is directly integrated.
-
Styling support: Bootstrap 5 (Tailwind CSS coming soon).
-
With this feature, you can focus on the logic of the application without having to copy and paste boilerplate forms.
š ļø Formello Installation
Installation is very easy. Install the package via composer:
composer require metalogico/laravel-formello
Publish your assets:
php artisan vendor:publish --tag=formello-assets
To automatically update assets every time composer updates, just add this to composer.json:
"scripts": { "post-update-cmd": [ "@php artisan vendor:publish --tag=formello-assets --force" ] }
š How to Use Formello in Laravel
Alright, letās get hands-on with Formello. Hereās how you can start using it in your Laravel project.
1. Create a Form Class
First, create a form class that extends
Metalogico\Formello\Formello
.
Hereās a simple example for a ProductForm:<?php namespace App\Forms; use Metalogico\Formello\Formello; use Metalogico\Formello\Widgets\SelectWidget; class ProductForm extends Formello { protected function create(): array { return [ 'method' => 'POST', 'action' => route('products.store'), ]; } protected function edit(): array { return [ 'method' => 'POST', 'action' => route('products.update', $this->model->id), ]; } protected function fields(): array { return [ 'name' => [ 'label' => __('Product Name'), 'help' => 'Enter the name of the product', ], 'description' => [ 'label' => __('Description'), ], 'category_id' => [ 'label' => __('Category'), 'widget' => 'select', 'choices' => Category::pluck('name', 'id')->toArray(), ], 'in_stock' => [ 'label' => __('In Stock'), ], ]; } }
ā ļø Note: Make sure these fields are added to your modelās $fillable array, otherwise Formello wonāt render them.
class Product extends Model { protected $fillable = [ 'name', 'category_id', 'description', 'in_stock', ]; }
š Read the full article at ramacan.dev
-