Download the PHP package koriym/file-upload without Composer

On this page you can find all versions of the php package koriym/file-upload. 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 file-upload

Koriym.FileUpload

codecov Type Coverage Psalm Level Continuous Integration

Type-safe file upload handling with immutable value objects.

Motivation

Testing file uploads in PHP applications is traditionally complex and time-consuming. It often requires setting up a built-in web server, making HTTP requests, and managing multipart form data. This approach leads to slow, unreliable tests that are difficult to debug and maintain, especially in CI environments.

This library simplifies both the handling of file uploads and their testing. Instead of dealing with PHP's native $_FILES array directly, you work with immutable value objects that provide type safety and early validation. For testing, rather than simulating HTTP file uploads, you can create test instances directly from files on your filesystem. This approach makes tests faster, more reliable, and easier to debug while still testing real-world scenarios with actual file types and contents.

Installation

Usage

From $_FILES

From File Path (for Testing)

Properties

Both FileUpload and ErrorFileUpload have the following properties:

Additionally, ErrorFileUpload has:

Validation Options

You can pass the following validation options to both create() and fromFile():

Testing

Using toArray()

The library provides a toArray() method to convert a FileUpload object back to $_FILES format array, which is useful for creating test stubs:

Using fromFile()

For more realistic testing scenarios, you can create a FileUpload instance directly from a file:

This is particularly useful when you want to test with real files and MIME types.

Note: The move() method behaves differently in CLI and web environments:

Testing Tips

Testing Code That Depends on $_FILES

When testing code that depends on $_FILES, you can use the combination of fromFile() and toArray() to create controlled, reproducible tests without the complexity of setting up actual HTTP file uploads:

See the example in docs/UploadHandlerTest.php.

Similar Libraries

Both Symfony HttpFoundation and Laravel provide file upload handling as part of their frameworks. While these frameworks offer more comprehensive features including storage abstraction and integration with their ecosystems, Koriym.FileUpload takes a more focused approach by providing a lightweight, framework-independent solution that transforms PHP's native $_FILES array into type-safe immutable objects.

Additional Information

PHP's $_FILES structure:

For multiple file uploads:

PHP Upload Error Codes:


All versions of file-upload with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-fileinfo Version *
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 koriym/file-upload contains the following files

Loading the files please wait ....