PHP code example of albert221 / laravel-filepond

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

    

albert221 / laravel-filepond example snippets


// app/Http/Controllers/SomeController.php

public function someAction(Request $request, Filepond $filepond)
{
    // Thanks to `fromRequest` method, it works both when JS was on and off.
    /** @var UploadedFile|[]UploadedFile $file */
    $file = $filepond->fromRequest($request, 'file');
    
    // (...)
}

// app/Http/Requests/SomeRequest.php

public function rules(FilepondSerializer $filepondSerializer): array
{
    return [
        'foobar' => '($filepondSerializer, [
                'mimetypes:audio/mpeg'
            ]),
        ],
    ];
}
bash
php artisan vendor:publish --provider="Albert221\Filepond\FilepondServiceProvider"
js
FilePond.setOptions({
  server: '/filepond'
});