PHP code example of glueful / storage-s3
1. Go to this page and download the library: Download glueful/storage-s3 library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
glueful / storage-s3 example snippets
's3' => [
'driver' => 's3',
'bucket' => env('AWS_BUCKET'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('AWS_PREFIX', ''),
'cdn_base_url' => env('AWS_CDN_BASE_URL'),
'signed_ttl' => (int) env('AWS_SIGNED_URL_TTL', 3600),
'max_signed_ttl' => (int) env('AWS_MAX_SIGNED_URL_TTL', 86400),
],
'r2' => [
'driver' => 's3',
'preset' => 'r2',
'account' => env('R2_ACCOUNT_ID'),
'bucket' => env('R2_BUCKET'),
'key' => env('R2_ACCESS_KEY_ID'),
'secret' => env('R2_SECRET_ACCESS_KEY'),
'signed_ttl' => (int) env('R2_SIGNED_URL_TTL', 3600),
'max_signed_ttl' => (int) env('R2_MAX_SIGNED_URL_TTL', 86400),
],
'minio' => [
'driver' => 's3',
'preset' => 'minio',
'endpoint' => env('MINIO_ENDPOINT', 'http://127.0.0.1:9000'),
'bucket' => env('MINIO_BUCKET'),
'key' => env('MINIO_ACCESS_KEY'),
'secret' => env('MINIO_SECRET_KEY'),
'signed_ttl' => (int) env('MINIO_SIGNED_URL_TTL', 3600),
'max_signed_ttl' => (int) env('MINIO_MAX_SIGNED_URL_TTL', 86400),
],
'spaces' => [
'driver' => 's3',
'preset' => 'spaces',
'region' => env('SPACES_REGION'),
'bucket' => env('SPACES_BUCKET'),
'key' => env('SPACES_ACCESS_KEY_ID'),
'secret' => env('SPACES_SECRET_ACCESS_KEY'),
'signed_ttl' => (int) env('SPACES_SIGNED_URL_TTL', 3600),
'max_signed_ttl' => (int) env('SPACES_MAX_SIGNED_URL_TTL', 86400),
],
'wasabi' => [
'driver' => 's3',
'preset' => 'wasabi',
'region' => env('WASABI_REGION', 'us-east-1'),
'bucket' => env('WASABI_BUCKET'),
'key' => env('WASABI_ACCESS_KEY_ID'),
'secret' => env('WASABI_SECRET_ACCESS_KEY'),
'signed_ttl' => (int) env('WASABI_SIGNED_URL_TTL', 3600),
'max_signed_ttl' => (int) env('WASABI_MAX_SIGNED_URL_TTL', 86400),
],
// config/uploads.php
'native_urls' => [
'disks' => [
's3' => [
'enabled' => true,
'public' => true,
'private' => false,
'private_ttl' => 300,
],
],
'max_private_ttl' => 900,
],
bash
php glueful storage:test s3