Flick
Guide Validation Services API Pro Examples GitHub
Docs / Getting Started

Getting Started

Flick is a PHP form library for developers who don't want the overhead of a framework. Just forms that work, deployed wherever PHP runs.

1. Install

composer require flickphp/flick

2. Instantiate

Include the Composer autoload file and instantiate Flick.

require 'vendor/autoload.php';

$form = new Flick\Flick();

Alternative Syntax

You can also use the fluent factory method if you prefer:

$form = Flick\Flick::make();

Both are equivalent—make() just returns a new instance.

3. Create

Add each form field label to Flick's create() method and Flick will take care of the rest. The default element type is text, however, you can change this by adding a pipe character and the new element type, such as textarea.

$form->create('Name, Email, Comments|textarea');

The following form is generated: complete with protection from CSRF attacks and HTML injection, plus form field values retained and populated upon form submission. It's literally production ready.

<form action="/" method="POST" id="myForm">
    <input type="hidden" name="_id" value="myForm">
    <input type="hidden" name="_token" value="8e5c4cff8a4d0b41a41aa2a99|etc...">
    <div class="flick-field">
        <label for="name" class="flick-label">Name</label>
        <input type="text" name="name" id="name" value="" class="flick-input ">
        <div id="has-error-name" class="flick-error" style="display:none"></div>
    </div>
    <div class="flick-field">
        <label for="email" class="flick-label">Email</label>
        <input type="text" name="email" id="email" value="" class="flick-input ">
        <div id="has-error-email" class="flick-error" style="display:none"></div>
    </div>
    <div class="flick-field">
        <label for="comments" class="flick-label">Comments</label>
        <textarea name="comments" id="comments" class="flick-input flick-textarea "></textarea>
        <div id="has-error-comments" class="flick-error" style="display:none"></div>
    </div>
    <div class="flick-field">
        <button type="submit" id="submit" class="flick-button ">Submit</button>
    </div>
</form>

Those flick-* classes come from Flick's own views, which is the default. Pass a views name to get Bootstrap, Tailwind, Bulma, Foundation, or Materialize markup instead — new Flick\Flick('bootstrap') swaps them for mb-3, form-label, form-control, and btn btn-primary. See views.

4. Validate

Retrieving and validating the form's values is just as easy. Simply add each field's label, then your validation rules inside square brackets. You can even add custom error messages for each rule.

// 'r' is short for 'required' :)
$request = $form->request('Name[required], Email[r, email], Comments[r, min:5]');

// now get the values...
$name = $request['name'];
$email = $request['email'];
$comments = $request['comments'];

What's Next?

You now have a production-ready form with CSRF protection, validation, and retained values. From here you can:

Flick Pro

Need more power? Flick Pro adds premium services:

  • Mail - Send emails with templates, attachments, and multiple transports
  • SQL - Database operations with PDO and query builder
  • Upload - File uploads with validation and cloud storage
  • Auth - Session-based authentication
  • reCAPTCHA / Turnstile - Bot protection
  • Validation - Client-side JavaScript validation
  • Checkout - Hosted payments with Polar and Stripe
  • OTP - One-time email codes for passwordless login and 2FA
  • Throttle - Per-client rate limiting for logins and form submissions

Pro requires a license. Purchase here, then follow the installation guide.


Frequently Asked Questions

What is Flick PHP?

Flick is a free PHP form library that lets you build production-ready forms in seconds. It includes 40+ validation rules and CSRF protection. Works anywhere PHP runs - no framework required.

How do I install Flick?

Install Flick with a single Composer command:

composer require flickphp/flick

Then instantiate with $form = new Flick\Flick(); and you're ready to create forms.

Is Flick free to use?

Yes, the core Flick library is completely free and open source under the MIT license. It includes form building, 40+ validation rules, and CSRF protection. Flick Pro is a paid add-on ($99 per year) for email, database, uploads, and authentication.

Does Flick work with Laravel?

Yes, Flick works with Laravel via request and session adapters. You can use Laravel's Request object and session handling while keeping Flick's simple form API. Flick also works standalone without any framework.