Download the PHP package tvanc/files-array-organizer without Composer

On this page you can find all versions of the php package tvanc/files-array-organizer. 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 files-array-organizer

Files Array Organizer

Build status codecov

Getting Started Examples Explanation

Dealing with the $_FILES array in PHP sucks. Most solutions only work for a specific situation and aren't easily portable. This utility is designed to organize any possible incarnation of the $_FILES array into the structure you would intuitively expect. Getting data about uploaded files should be just as easy as reading the $_POST array.

Getting Started

Requirements

PHP >= 7.3

Installation

Examples

One input, one file

In a case like this, the $_FILES array is pretty straight forward and the organized version is identical to the unorganized version.

A single input that accepts multiple files

FilesArrayOrganizer makes dealing with this common scenario a little easier.

Multiple inputs that accept multiple files

FilesArrayOrganizer makes dealing with this less-common scenario much easier. Check the Explanation to see the surprising $_FILES array you can get from a form containing multiple inputs that each accept multiple files.

Execute a custom callback on each file

To alter how file data is represented, pass a callback as the second argument to FilesArrayOrganizer::organize(). The callback receives one argument, which is an array of file data. The callback's return value will be used to represent the file instead of the received array parameter.

Explanation

For some situations, dealing with the $_FILES superglobal is fine. Uploading a single file via a field named attachment would generate a simple $_FILES array like this:

Getting the file's attributes is easy. The path to the input's value corresponds to the name of the input field.

What about a field named todo[0][attachments][], which accepts multiple files? Working with the files from this field should be easy. Right?

Wrong.

You thought the $_FILES array would look like this.

It will actually look like this:

I leave it as an exercise for the reader to figure out how to extract the useful information out of that. If you don't want to repeat that exercise every time you need to handle more than one file at a time, just use this library.

To see how to use FilesArrayOrganizer with a $_FILES array just like this, see the example, Multiple inputs that accept multiple files.


All versions of files-array-organizer with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3
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 tvanc/files-array-organizer contains the following files

Loading the files please wait ....