albert221/laravel-filepond
Albert221/laravel-filepond
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.
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
660,512,042
9,702
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
450,320,528
608
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
424,642,029
4,662
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v1.0.2 | ^7.4 | ^7.0 | Apache-2.0 | |
| v1.0.0 | ^7.4 | ^7.0 | Apache-2.0 |