Download the PHP package dmalta/laravel-filepond without Composer

On this page you can find all versions of the php package dmalta/laravel-filepond. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-filepond

Laravel FilePond Backend

Latest Version on Packagist Total Downloads

A straight forward backend support for Laravel application to work with FilePond file upload javascript library. This package keeps tracks of all the uploaded files and provides an easier interface for the user to interact with the files. It currently features -

Attention: People who are already using version less than < 1.3.8 are requested to update the ./config/filepond.php file when upgrading as the newer version contains significant changes.

Installation

Install the package via composer:

Laravel 7 users use less than 1.x version.

Publish the configuration and migration files.

Run the migration.

Quickstart

Before we begin, first install and integrate the FilePond library in your project any way you prefer.

We will make up a scenario for the new-comers to get them started with FilePond right away.

Let's assume we are updating a user avatar and his/her gallery like the form below.

Now selecting a file with FilePond input field will upload the file in the temporary directory immediately and append the hidden input in the form. Submit the form to process the uploaded file like below in your controller.

In UserAvatarController.php get and process the submitted file by calling the moveTo() method from the Filepond facade which will return the moved file information as well as delete the file from the temporary storage.

This is the quickest way to get started. This package has already implemented all the classes and controllers for you. Next we will discuss about all the nitty gritty stuffs available.

Important: If you have Laravel debugbar installed, make sure to add filepond* in the except array of the ./config/debugbar.php to ignore appending debugbar information.

Configuration

First have a look at the ./config/filepond.php to know about all the options available out of the box. Some important ones mentioned below.

Permanent Storage

This package uses Laravel's public filesystem driver for permanent file storage by default. Change the disk option to anything you prefer for permanent storage. Hold up! But I am using different disks for different uploads. Don't worry. You will be able to change the disk name on the fly with copyTo() and moveTo() methods.

Temporary Storage

This package uses Laravel's local filesystem driver for temporary file storage by default. Change the temp_disk and temp_folder name to points towards directory for temporary file storage.

Note: Setting temporary file storage to third party will upload the files directly to cloud. On the other hand, you will lose the ability to use controller level validation because the files will not be available in your application server.

Validation Rules

Default global server side validation rules can be changed by modifying validation_rules array in ./config/filepond.php. These rules will be applicable to all file uploads by FilePond's /process route.

Middleware

By default all filepond's routes are protected by web and auth middleware. Change it if necessary.

Soft Delete

By default soft_delete is set to true to keep track of all the files uploaded by the users. Set it to false if you want to delete the files with delete request.

Table

By default Filepond model maps to table fileponds. Change it if you created a table with a different name in your database migration.

Commands (Cleanup)

This package includes a php artisan filepond:clear command to clean up the expired files from the temporary storage. File expiration minute can be set in the config file, default is 30 minutes. Add this command to your scheduled command list to run daily. Know more about task scheduling here - Scheduling Artisan Commands

This command takes a --all option which will truncate the Filepond model and delete everything inside the temporary storage regardless they are expired or not. This is useful when you lost track of your uploaded files and want to start clean.

If you see your files are not deleted even after everything is set up correctly, then its probably the directory permission issue. Try setting the permission of filepond's temporary directory to 775 with sudo chmod -R 775 ./storage/app/filepond/. And run php artisan filepond:clear --all for a clean start (optional). For third party storage like - amazon s3, make sure you have the correct policy set.

Methods

field()

Filepond::field($field) is a required method which tell the library which FilePond form field to work with. Chain the rest of the methods as required.

validate()

Calling the Filepond::field()->validate($rules) method will validate the temporarily stored file before moving or copying further. Supports both single and multiple files validation just as Laravel's default form validation does.

Note: This method is not available when third party storage is set as your temporary storage. The files are uploaded directly to your third party storage and not available locally for any further modification. Calling this method in such condition will throw error that the file is not found.

copyTo()

Calling the Filepond::field()->copyTo($pathWithFilename) method will copy the file from the temporary storage to the path provided along with the filename. It will set the file extension automatically. By default the files will be copied to directory relative to config's disk option. You can also pass a disk name as second parameter if you want to override that. This method will return the copied file info along with Filepond model id. For multiple file upload, it will return an array of copied files info. Also note that multiple files will be copied with trailing incremental values like $filename-{$i}.

moveTo()

Calling the Filepond::field()->moveTo($pathWithFilename) method works the same way as copyTo() method. By default the files will be moved to directory relative to config's disk option. You can also pass a disk name as second parameter if you want to override that. One thing it does extra for you is delete the temporary file after copying, respecting the value of config's soft_delete option for Filepond model.

delete()

Calling the Filepond::field()->delete() method will delete the temporary file respecting the soft delete configuration for Filepond model. This method is useful when you're manually handling the file processing using getFile() method.

APIs

If you need more granular approach and know the ins and outs of this package, you may use the below APIs to get the underneath file object and file model to interact with them further.

getFile()

Filepond::field()->getFile() method returns the file object same as the Laravel's $request->file() object. For multiple uploads, it will return an array of uploaded file objects. You can then process the file manually any way you want.

Processing the file object manually will not update the associated Filepond model which is used to keep track of the uploaded files. However the expired files will be cleaned up as usual by the scheduled command. It is recommended that you either call the getModel() method after the processing is done.

Note: This method is not available when third party storage is set as your temporary storage. The files are uploaded directly to your third party storage and not available locally for any further modification. Calling this method in such condition will throw error that the file is not found.

getModel()

Filepond::field()->getModel() method returns the underlying Laravel Filepond model for the given field. This is useful when you have added some custom fields to update in the published migration file for your need.

Traits

There is a HasFilepond trait available to get the temporary files uploaded by the users.

Now you can get all the files info uploaded by a single user like this.

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-filepond with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
illuminate/support Version ^7.0|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dmalta/laravel-filepond contains the following files

Loading the files please wait ....