Download the PHP package timefrontiers/php-file without Composer
On this page you can find all versions of the php package timefrontiers/php-file. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download timefrontiers/php-file
More information about timefrontiers/php-file
Files in timefrontiers/php-file
Package php-file
Short Description TimeFrontiers File — multi-driver file storage, expiring download tokens, and image size constraints
License MIT
Homepage https://github.com/timefrontiers/php-file
Informations about the package php-file
timefrontiers/php-file
Multi-driver file storage for PHP 8.3+. Handles upload, retrieval, and streaming of files across local and cloud storage backends, with expiring/download-limited tokens, image size enforcement, and file ownership.
Requirements
- PHP 8.3+
- MariaDB 10.4+ / MySQL 8.0+
timefrontiers/php-sql-databasetimefrontiers/php-database-objecttimefrontiers/php-has-errorstimefrontiers/php-paginationtimefrontiers/php-datatimefrontiers/php-validatorgumlet/php-image-resize(bundled — used for max-dimension enforcement on upload)
Optional:
aws/aws-sdk-php ^3.0— required when using the S3 or MinIO driver
Installation
For S3 or MinIO support:
Database
Run sql/install.sql against your file database to create the required tables:
Migrating from linktude/php-file? See sql/migrate.sql.
Configuration
Call File::configure() once in your application bootstrap, before any File instance is created.
base[] holds global settings. drivers[] is a keyed map where each key is a driver name and the value is that driver's config. Only the drivers you declare are available at runtime.
Validation at configure time:
default_drivermust match a key indrivers[]. An unknown driver, a missingdefault_driver, or a non-array driver entry all throw aConfigurationExceptionimmediately.
path_prefix — logical storage namespace
base.path_prefix is appended before /{owner} by the package automatically, producing a
consistent storage path across all drivers:
| Driver | Physical / key location |
|---|---|
local |
{upload_path}/{path_prefix}/{owner}/{filename} |
s3 |
Object key: {path_prefix}/{owner}/{filename} |
minio |
Object key: {path_prefix}/{owner}/{filename} |
Set it dynamically at configure-time based on the user's access level:
Local driver options
| Key | Required | Description |
|---|---|---|
upload_path |
✅ | Absolute filesystem root where files are stored |
storage_url |
✅ | Base URL for direct public access to files |
S3 driver options
| Key | Required | Description |
|---|---|---|
bucket |
✅ | S3 bucket name |
region |
— | AWS region (default us-east-1) |
key |
✅ | AWS access key ID |
secret |
✅ | AWS secret access key |
endpoint |
— | Custom endpoint for S3-compatible stores |
storage_url |
— | CDN override; if empty, native S3 URL is used |
MinIO driver options
| Key | Required | Description |
|---|---|---|
endpoint |
✅ | MinIO server URL (e.g. http://localhost:9000) |
bucket |
✅ | Bucket name |
region |
— | Ignored by MinIO but required by the SDK (default us-east-1) |
key |
✅ | MinIO access key |
secret |
✅ | MinIO secret key |
storage_url |
— | CDN/public URL override; if empty, URL is built as {endpoint}/{bucket}/{path} |
Usage
Upload
Load an existing file
Direct URL (public files only)
Download tokens
Tokens are HMAC-signed, driver-agnostic, and enforce both time expiry and download limits.
On your download endpoint:
Update metadata
Lock a file
Locking computes a SHA-512 checksum and prevents further updates.
Delete a file
Default files
Map an owner string to one or more named file slots.
Folders
Storage drivers
| Driver | Status | Notes |
|---|---|---|
local |
✅ Full | Default. Files stored under drivers.local.upload_path. |
s3 |
✅ Full | Requires aws/aws-sdk-php. Standard AWS S3 or S3-compatible endpoint. |
minio |
✅ Full | Requires aws/aws-sdk-php. Path-style endpoint enforced. endpoint is required. |
gcs |
🔲 Stub | Throws DriverException — implementation coming. |
onedrive |
🔲 Stub | Throws DriverException — implementation coming. |
dropbox |
🔲 Stub | Throws DriverException — implementation coming. |
The driver used to store a file is recorded in file_meta.storage_driver. When a file is loaded from the database, the correct driver is automatically resolved for streaming and deletion — regardless of the current default_driver setting.
Image constraints
Configured in base[]. Applied automatically on every upload before the file reaches storage.
| Key | Effect |
|---|---|
max_width_px |
Images wider than this are resized down (aspect ratio preserved) |
max_height_px |
Images taller than this are resized down |
min_width_px |
Images narrower than this are rejected |
min_height_px |
Images shorter than this are rejected |
Set any value to null to disable that constraint. Non-image files pass through all checks untouched.
Note: Full image manipulation (crop, rotate, watermark) is planned for
timefrontiers/php-image.
Ownership
All ownership fields are VARCHAR(64) strings — not foreign keys — so they can hold user codes, system constants, or any arbitrary identifier.
| Table | Column | Example values |
|---|---|---|
file_meta |
owner |
'08744307265', 'SYSTEM', 'SYSTEM.HIDDEN' |
file_default |
user |
'08744307265', 'SYSTEM' |
folders |
owner |
'08744307265', 'SYSTEM' |
License
MIT — see LICENSE.
All versions of php-file with dependencies
gumlet/php-image-resize Version ^2.0
timefrontiers/php-sql-database Version ^1.0
timefrontiers/php-database-object Version ^1.0
timefrontiers/php-has-errors Version ^1.0
timefrontiers/php-pagination Version ^1.0
timefrontiers/php-data Version ^1.0
timefrontiers/php-validator Version ^1.0