Configuring AWS S3 Storage (Zero Dependencies)

1. High-Level Architectural Summary

Zero CMS features a highly optimized, 100% zero-dependency AWS S3 Storage Driver. In line with our strict core mandates (Rule 7), this driver bypasses the bloated, multi-megabyte AWS PHP SDK completely. Instead, it natively compiles and executes the **AWS Signature Version 4 (SigV4)** cryptographic request signing algorithm directly using raw PHP hash_hmac sessions, and executes REST API handshakes via PHP cURL. This keeps the codebase extremely lightweight, fast, transparent, and completely free of vendor security supply chain vulnerabilities.

2. Configuration and Environment Setup

To activate S3 cloud storage for your assets and cached crops, define S3 credentials inside your active .env file:

# Set active storage driver to AWS S3
STORAGE_DRIVER=s3

# Define target AWS S3 Bucket Name
AWS_S3_BUCKET=your-bucket-name-here

# Define your AWS Access Key ID
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE

# Define your AWS Secret Access Key
AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

# Define your AWS Region (defaults to us-east-1)
AWS_DEFAULT_REGION=us-east-1

3. Utilizing the S3 Storage API

Once configured inside your environmental file, all core uploads, page builder assets, and crops caching automatically route through Amazon's S3 driver. You can also invoke the static Storage API from any custom module or controller seamlessly:

use Zero\Core\Storage\Storage;

// 1. Write file to AWS S3
Storage::write('uploads/contracts/agreement-123.txt', 'Raw Contract Data Payload');

// 2. Check if file exists on S3
if (Storage::exists('uploads/contracts/agreement-123.txt')) {
    // 3. Resolve S3 public URL
    $url = Storage::getUrl('uploads/contracts/agreement-123.txt');
    // Returns: https://your-bucket.s3.us-east-1.amazonaws.com/uploads/contracts/agreement-123.txt
}