Skip to content

Package providing basic FilePond Laravel functionality and help handling files sent with JS disabled.

License

Notifications You must be signed in to change notification settings

Albert221/laravel-filepond

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Albert221/laravel-filepond

Packagist GitHub Workflow Status

This package provides basic FilePond Laravel functionality and helps handle files sent with JS disabled.

This package was written in a real hurry. It may not be well documented or well tested, but should work. Pull Requests fixing that are welcome.

Installation

composer require albert221/laravel-filepond

If you need to change configuration:

php artisan vendor:publish --provider="Albert221\Filepond\FilepondServiceProvider"

Usage

Frontend

FilePond.setOptions({
  server: '/filepond'
});

Backend

// 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');
    
    // (...)
}

Validation

// app/Http/Requests/SomeRequest.php

public function rules(FilepondSerializer $filepondSerializer): array
{
    return [
        'foobar' => 'required',
        'file' => [
            'required',
            // It validates both UploadedFile and FilePond's serverId
            new FilepondRule($filepondSerializer, [
                'mimetypes:audio/mpeg'
            ]),
        ],
    ];
}

License

This project was heavily inspired by Sopamo/laravel-filepond.

This project is on Apache 2.0 license.

About

Package providing basic FilePond Laravel functionality and help handling files sent with JS disabled.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages