PHP code example of rawnoq / laravel-form-data-parser

1. Go to this page and download the library: Download rawnoq/laravel-form-data-parser 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/ */

    

rawnoq / laravel-form-data-parser example snippets


// In your controller
public function update(Request $request)
{
    // Access form data
    $name = $request->input('name');
    $nameAr = $request->input('name.ar'); // Nested notation
    $itemName = $request->input('items.0.name'); // Array notation
    
    // Access files
    $avatar = $request->file('avatar');
    $documents = $request->file('documents'); // Array of files
    
    // Process your request...
}

// Simple fields
name=John

// Nested fields
name[ar]=جون
name[en]=John

// Array fields
items[0][name]=Item 1
items[1][name]=Item 2

// Mixed with files
avatar=file
name[ar]=جون