Download the PHP package ez-php/storage without Composer

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

ez-php/storage

File storage abstraction for the ez-php framework.

Provides a unified interface (put, get, delete, exists, url) over pluggable drivers. Ships with a LocalDriver (filesystem), an S3Driver (AWS S3 and S3-compatible APIs via cURL + AWS Signature V4), and a GcsDriver (Google Cloud Storage via cURL + Bearer access token). Integrates with UploadedFile from ez-php/http.


Installation


Configuration

Add config/storage.php to your application:

Register the provider in provider/modules.php:


Usage

Via static façade

Storing an uploaded file

Via dependency injection


Serving files over HTTP

StorageResponse turns a stored file into a response — with Range support so browsers can seek in audio/video and resume downloads:

Request Response
no Range 200, Content-Length, Accept-Ranges: bytes
Range: bytes=2-5 / bytes=15- / bytes=-4 206 + Content-Range: bytes 2-5/20
unsatisfiable (bytes=100- on a 20-byte file) 416 + Content-Range: bytes */20
several ranges, another unit, malformed 200, the whole file
unknown path 404

Range needs a seekable stream (local files, in-memory); for a non-seekable remote stream the whole file is streamed without Content-Length. If-Range is not evaluated.

Let the web server send the file (PHP only checks access):

Expiring links for the LocalDriver (the S3 driver's url() is already presigned):

The signature is HMAC-SHA256 over the path and the expiry, compared in constant time; changing either invalidates it. A link is valid until it expires (no single-use tracking).

Drivers

LocalDriver

Stores files under a configurable root directory. Creates nested directories automatically.

S3Driver

Uploads and retrieves objects using cURL with AWS Signature Version 4. Works with AWS S3 and any S3-compatible service (MinIO, Cloudflare R2, DigitalOcean Spaces).

GcsDriver

Uploads and retrieves objects using cURL against the Google Cloud Storage JSON API, authenticated with a Bearer access token you supply (e.g. from gcloud auth print-access-token, or a workload-identity/metadata-server token in production). The driver never mints or refreshes tokens itself.

InMemoryDriver (tests only)

Keeps file contents in a PHP array — no filesystem, no network. Use it to test code that depends on StorageInterface without writing real files.

Set STORAGE_DRIVER=memory to use it via the service provider.


Running Tests

S3 integration tests are skipped unless AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_BUCKET are set in the environment. GCS integration tests are likewise skipped unless GCS_BUCKET and GCS_ACCESS_TOKEN are set.


All versions of storage with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
ext-curl Version *
ez-php/contracts Version ^2.7.0
ez-php/http Version ^2.7.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 ez-php/storage contains the following files

Loading the files please wait ...