PHPackages                             flickphp/migrate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. flickphp/migrate

ActiveLibrary[Database &amp; ORM](/categories/database)

flickphp/migrate
================

Migration tool for converting Formr to Flick.

v1.0.0(today)01↑2900%MITPHPPHP ^8.3CI passing

Since Aug 25Pushed todayCompare

[ Source](https://github.com/flickphp/migrate)[ Packagist](https://packagist.org/packages/flickphp/migrate)[ Docs](https://github.com/flickphp/migrate)[ GitHub Sponsors](https://github.com/flickphp)[ RSS](/packages/flickphp-migrate/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Formr to Flick Migration Tool
=============================

[](#formr-to-flick-migration-tool)

A CLI tool that automatically converts [Formr](https://formr.github.io) PHP code to [Flick](https://flickphp.com).

When to Use
-----------

[](#when-to-use)

Use this tool when you have an existing codebase using the Formr library and want to upgrade to Flick. The tool handles:

- Namespace and class name conversions
- 60+ method name mappings
- Validation rule syntax transformation
- Property-to-config migrations

Installation
------------

[](#installation)

Install it as a dev dependency in the project you're migrating — the tool only rewrites source files, so it is not needed at runtime:

```
composer require --dev flickphp/migrate
```

Usage
-----

[](#usage)

```
# Migrate a single file
./vendor/bin/migrate-formr /path/to/file.php

# Migrate an entire directory (recursive)
./vendor/bin/migrate-formr /path/to/directory

# Preview changes without modifying files
./vendor/bin/migrate-formr /path/to/file.php --dry-run
```

Configuration
-------------

[](#configuration)

There is nothing to configure — the tool is a one-shot CLI. Its behavior is controlled entirely by flags:

FlagDescription`--dry-run`, `-n`Preview the changes without writing any files`--help`, `-h`Show help`--version`, `-v`Show the versionBy default the tool rewrites files **in place**, writing a sibling `*.bak` next to each file before overwriting it so a bad run is recoverable. Only files that contain a real Formr class reference are processed; everything else is skipped. The command exits non-zero if any file could not be read or written.

---

What Gets Converted
-------------------

[](#what-gets-converted)

### Namespaces

[](#namespaces)

- `Formr\Formr` → `Flick\Flick`
- `new Formr()` → `new Flick()`
- `new Formr('bootstrap')` → `new Flick(['views' => 'bootstrap'])`

### Methods (60+ mappings)

[](#methods-60-mappings)

FormrFlick`create_form()``create()``form_open()``open()``form_close()``close()``input_text()``text()``input_email()``email()``input_password()``password()``input_hidden()``hidden()``input_checkbox()``checkbox()``input_radio()``radio()``checkbox_inline()``checkboxInline()``radio_inline()``radioInline()``input_select()``select()``error_message()``errorMessage()``in_errors()``hasError()``submit()``submitted()` (only inside an `if`/`while`/`elseif` condition)`submit_button()``submit()``input_submit()``submit()` (arguments reordered, see below)`input_button_submit()``submit()` (arguments reordered, see below)`post()``request()``get()``request()``validate()``request()``send_email()``$form->mail->send()``send_html_email()``$form->mail->send(..., ['html' => ...])`> `textarea()` and `ok()` keep the same name in Flick, so they are left unchanged.

**Submit buttons move their arguments.** Formr's `input_submit($name, $label, $value, $id, $string)` carries the button text in `$value`; Flick's `submit($text, $attributes)` carries it first. The tool moves it, and passes `$string` through as the attributes:

```
$form->input_submit('submit', '', 'Send', '', 'class="btn"');
// becomes
$form->submit('Send', 'class="btn"');
```

`$name`, `$label` and `$id` have nowhere to go — Flick's `submit()` renders no label and hard-codes `name="submit"` / `id="submit"` — so anything other than Formr's own defaults is flagged with a TODO rather than dropped. That includes the one-argument form: `input_submit('Send')` sets the *name*, not the text (Formr renders a button that still says "Submit"), so it becomes `submit()`plus a TODO about the lost name.

`submit_button($value)` already leads with the text, so it converts straight across.

### Validation Rules

[](#validation-rules)

FormrFlick`required|min[5]|max[50]``required, min:5, max:50``valid_email``email``valid_url``url``alpha_numeric``alphaNumeric``min_length[5]``min:5``max_length[50]``max:50``greater_than[0]``greaterThan:0``less_than[100]``lessThan:100``is_numeric``numeric``valid_ip``ip``matches[field]``matches:field`### Inline Validation Syntax

[](#inline-validation-syntax)

```
// Formr uses pipes and parentheses
$form->validate('Name(required|min[2]), Email(valid_email)');

// Flick uses commas and brackets
$form->request('Name[required, min:2], Email[email]');
```

> A single rule converts too — `Email(valid_email)` becomes `Email[email]`. What the tool will not touch is a parenthesized value it doesn't recognise as rules: `Category(electronics)` is left alone, because in Flick that syntax means a prebuilt dropdown, and guessing wrong either way breaks the form. Rules are converted, never invented: nothing gains a `required` it didn't have.

---

What Gets Flagged with TODOs
----------------------------

[](#what-gets-flagged-with-todos)

The tool inserts `// TODO: FLICK MIGRATION` comments for items requiring manual attention:

### Pro-Required Features

[](#pro-required-features)

Some methods map to [Flick Pro](https://flickphp.com/pro) services. Mail methods are rewritten; reCAPTCHA calls are only flagged (the method name is kept):

Formr MethodResultNotes`send_email($to, $subj, $body)``$form->mail->send($to, $subj, $body)`Rewritten; configure the mail service in the constructor`send_html_email($to, $subj, $html)``$form->mail->send($to, $subj, '', ['html' => $html])`Rewritten; HTML body moved to the options array`recaptcha_*()`*(name kept)***Not** rewritten — flagged with a Pro TODO; convert to `$form->recaptcha->scripts()`/`->passed()` by hand`upload($field)``$form->file($field)`Rewritten to the core `file()` method (no Pro TODO); switch to `$form->upload->image()` if you want Pro image processing**Mail service configuration required:**

```
$form = new Flick([
    'services' => [
        'mail' => [
            'fromAddress' => 'noreply@example.com',
            'mailer' => [
                'transport' => 'smtp',
                'host' => 'smtp.example.com',
                // ... other options
            ]
        ]
    ]
]);
```

### Validation Rules That Become Modifiers

[](#validation-rules-that-become-modifiers)

Formr RuleFlick Modifier`hash``bcrypt` modifier`sanitize_string``stripTags` modifier`sanitize_email``sanitizeEmail` modifier### Properties With No Direct Equivalent

[](#properties-with-no-direct-equivalent)

PropertyMigration Notes`required = '*'`Use CSS to style required fields`inline_errors`Configure in view templates`custom_validation_messages`Use per-field messages---

Complete Before/After Examples
------------------------------

[](#complete-beforeafter-examples)

### Example 1: Contact Form

[](#example-1-contact-form)

**Before (Formr):**

```
