kha333n/laravel-filepond 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kha333n/laravel-filepond

最新稳定版本:v2.0.0

Composer 安装命令:

composer require kha333n/laravel-filepond

包简介

Laravel backend module for filepond uploads

README 文档

README

Laravel FilePond Backend

An all in one Laravel backend for FilePond



Note

If you are using Laravel with Vue.js, check out another package from us which just went to alpha:

Check out double



🚀 Be up and running in 2 minutes

Laravel setup

Require this package in the composer.json of your Laravel project.

composer require kha333n/laravel-filepond

If you need to edit the configuration, you can publish it with:

php artisan vendor:publish --provider="Sopamo\LaravelFilepond\LaravelFilepondServiceProvider"
// Get the temporary path using the serverId returned by the upload function in `FilepondController.php`
$filepond = app(\Sopamo\LaravelFilepond\Filepond::class);
$disk = config('filepond.temporary_files_disk');

$path = $filepond->getPathFromServerId($serverId);
$fullpath = Storage::disk($disk)->get($filePath);


// Move the file from the temporary path to the final location
$finalLocation = public_path('output.jpg');
\File::move($fullpath, $finalLocation);

External storage

You can use any Laravel disk as the storage for temporary files. If you use a different disk for the temporary files and the final location, you will need to copy the file from the temporary location to the new disk then delete the temporary file yourself.

If you are using the default local disk, make sure the /storage/app/filepond directory exists in your project and is writable.

Filepond client setup

This is the minimum Filepond JS configuration you need to set after installing laravel-filepond.

FilePond.setOptions({
  server: {
    url: '/filepond/api',
    process: {
      url: "/process",
      headers: (file: File) => {
        // Send the original file name which will be used for chunked uploads
        return {
          "Upload-Name": file.name,
          "X-CSRF-TOKEN": "{{ csrf_token() }}",
        }
      },
    },
    revert: '/process',
    patch: "?patch=",
    headers: {
      'X-CSRF-TOKEN': '{{ csrf_token() }}'
    }
  }
});

Package development

Please make sure all tests run successfully before submitting a PR.

Testing

  • Start a docker container to execute the tests in with docker run -it -v $PWD:/app composer /bin/bash
  • Run composer install
  • Run ./vendor/bin/phpunit

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 57
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-03