Download the PHP package initphp/upload without Composer

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

InitPHP Upload

Validate and store uploaded files on local disk, FTP/FTPS or Amazon S3 through a single, adapter-based API.

CI Latest Stable Version Total Downloads License PHP Version Require

Requirements

Installation

For S3 uploads, also install the AWS SDK:

Quick start

File::setPost('photos') reads $_FILES['photos'] and returns a normalized File[], whether the field uploaded one file or many. to() validates the file, stores it, and returns the stored File (with its public URL set) or false if the underlying write failed. Any validation or transfer problem is thrown as an UploadException.

Loading files

Call Returns Purpose
File::setPost(string $key) File[] Normalize $_FILES[$key] (single or multiple) into File objects.
File::setPath(string $path) File Wrap an existing file already on disk.

A file loaded with setPath() is copied to its destination (the source is left in place); a real HTTP upload is moved with move_uploaded_file().

Adapters

All three adapters share the same API — only the credentials differ. The optional second constructor argument is the validation options, identical across adapters.

Adapter Credentials Notes
LocalAdapter dir, url Creates missing destination directories.
FTPAdapter host, port, username, password, timeout, url, passive, ssl Binary mode, passive by default, optional FTPS.
S3Adapter key, secret_key, region, bucket, ACL, version Requires aws/aws-sdk-php.

The to($target) argument

$target means the same thing in every adapter: a destination path/key prefix. to('avatars/2026') stores the file under that sub-path:

Call to() with no argument to store the file at the destination root.

Validation options

Pass these as the second constructor argument of any adapter (an empty array or 0 means "no restriction"):

Option Type Meaning
allowed_extensions string[] Allowed file extensions, matched case-insensitively against the original file name.
allowed_mime_types string[] Allowed MIME types, matched against the real type detected with finfo (not the client-supplied one).
allowed_max_size int Maximum size in bytes.

A file that violates any restriction — or whose upload errored — makes to() throw an UploadException.

Renaming

Documentation

Full guides with examples live in docs/:

Contributing

Bug reports and pull requests are welcome. CI runs PHP-CS-Fixer, PHPStan (max level) and PHPUnit across PHP 8.0–8.4; run the same bundle locally with:

Credits

License

Copyright © 2023 InitPHP — released under the MIT License.


All versions of upload with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
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 initphp/upload contains the following files

Loading the files please wait ...