A stupidly-fast PHP form builder. One line of code builds a complete HTML form, with built-in server-side validation, CSRF protection, and all the other stuff you and your users need to stay fast and safe.
Sure, you can get AI to build your forms, but then you have to maintain them. And the more you build, the bigger the maintenance headache because none of them will be the same.
Flick is the successor to Formr, which I also wrote. If you're coming from Formr, flickphp/migrate converts your old code for you.
Full docs here: flickphp.com
If you find Flick useful, please consider starring the project. Thank you!
composer require flickphp/flickFlick works with zero configuration. To change defaults, pass a config array:
$form = new Flick\Flick([
'views' => 'bootstrap', // CSS framework view: flick, bootstrap, bulma, tailwind, ...
]);See the full configuration reference at https://flickphp.com/guide/configuration.
<?php
require 'vendor/autoload.php';
$form = new Flick\Flick();
// Renders the form, handles submission, and validation
$form->createAndValidate('Name[required], Email[r,email], Message|textarea[max:255]');<?php
require 'vendor/autoload.php';
$form = new Flick\Flick();
// Handle submission
if ($form->submitted()) {
$data = $form->request('Name[required], Email[required, email], Message[min:10]');
if ($form->ok()) {
echo "Thanks, {$data['name']}!";
}
}
// Render the form
$form->create('Name, Email, Message|textarea');That's it. You get:
- CSRF protection (automatic)
- HTML injection prevention (automatic)
- Server-side validation
- Error messages that stick
- Values that persist on errors
$form = new Flick\Flick(['views' => 'tailwind']);
// Also: flick, bootstrap, bootstrap4, bulma, foundation, materializeContact form with honeypot spam protection:
$form = new Flick\Flick([
'honeypot' => 'website_url',
'views' => 'tailwind',
]);
if ($form->submitted()) {
$data = $form->request('
Name[required],
Email[required, email],
Phone[phone],
Message[required, min:10, max:1000]
');
if ($form->ok()) {
// Send email, save to database, etc.
}
}
$form->create('Name, Email, Phone, Message|textarea');Registration with password confirmation:
if ($form->submitted()) {
// confirmed compares password against password_confirmation
$data = $form->request('
Username[required, min:3, alphaDash],
Email[required, email],
Password[required, strongPassword, confirmed],
Password Confirmation[required]
');
if ($form->ok()) {
// $data['password'] is ready to use
}
}
$form->create('Username, Email, Password|password, Password Confirmation|password');Build forms field by field:
$form->open('/contact');
$form->text('name', 'Your Name');
$form->email('email', 'Email Address');
$form->select('subject', 'Subject', '', ['General', 'Support', 'Sales']);
$form->textarea('message', 'Message');
$form->submit('Send');
$form->close();Flick Pro adds:
- Auth – Login, registration, password reset
- Checkout – Hosted payments with Polar and Stripe
- Mail – Send emails with any provider
- OTP – One-time email codes for login and 2FA
- SQL – Database queries made simple
- Throttle – Rate limiting for logins and forms
- Upload – File uploads with validation
- Validation – Real-time JavaScript validation
- reCAPTCHA & Turnstile – Bot protection
Full docs, validation rules, and examples at flickphp.com
For AI coding assistants, comprehensive API references are available:
- llms.txt – Quick reference
- llms-full.txt – Complete API documentation
- PHP 8.3+
- ext-ctype, ext-curl, ext-fileinfo, ext-openssl
- Flick Documentation - Full Flick documentation
- Flick for Laravel - Laravel integration
- Flick Migrate - Formr to Flick migration tool
- Flick Pro - Premium services
MIT