PHP code example of headlesslaravel / fields

1. Go to this page and download the library: Download headlesslaravel/fields 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/ */

    

headlesslaravel / fields example snippets


$fields = Fields::form([
    // Your field configurations
]);

$fields = Fields::display([
    // Your field configurations
], $data);

Text::make('First Name')->prop('span', 6)

// Form field configuration
$formFields = Fields::form([
    Text::make('First Name')->prop('span', 6),
    Text::make('Last Name')->prop('span', 6),
    Text::make('Email')->prop('span', 6),
    Text::make('Phone')->prop('span', 6),
]);

// Display field configuration
$displayFields = Fields::display([
    Text::make('Name', 'name'),
    Text::make('Email', 'email'),
    Text::make('Phone', 'phone'),
], $user);

// Return the field configurations as an array
return [
    'form' => $formFields,
    'display' => $displayFields,
];