PHP code example of mrclln / wire-form-builder

1. Go to this page and download the library: Download mrclln/wire-form-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mrclln / wire-form-builder example snippets


// Schema JSON string -> array of field definitions.
$array = $formBuilder->parseSchema($form->schema);

// Pretty-printed JSON schema (internal ids stripped).
$json = $formBuilder->getSchemaJson();

[
    'name' => 'text_field',
    'label' => 'Text Field',
    'type' => 'text',
    'value' => 'user typed value',
],

use FormBuilder;

// JSON string or array -> list of field definitions (ids normalised).
$fields = FormBuilder::fieldsFromSchema($form->schema);

// List of field definitions -> pretty-printed JSON schema (ids stripped).
$json = FormBuilder::schemaFromFields($fields);

// Parse a schema (JSON string or array) into an array of field definitions.
$array = FormBuilder::parseSchema($form->schema);

// Alias of fieldsFromSchema() — returns the schema as a plain PHP array.
$array = FormBuilder::toArray($form->schema);

'controls' => [
    'text' => [
        'label' => 'block text-sm font-semibold text-gray-900 mb-1',
        'input' => 'w-full rounded-lg border-gray-400 ...',
    ],
],
js
export default {
    content: [
        './resources/**/*.blade.php',
        './vendor/mrclln/wire-form-builder/**/*.blade.php',
        './vendor/mrclln/wire-form-builder/config/**/*.php',
    ],
};
bash
php artisan vendor:publish --tag=wire-form-builder-config
php artisan vendor:publish --tag=wire-form-builder-views