1. Go to this page and download the library: Download appoly/s3-uploader 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/ */
use Appoly\S3Uploader\Services\MultipartUploadService;
class UploadController
{
public function __construct(
private MultipartUploadService $uploader
) {}
public function start()
{
return $this->uploader->initiateMultipartUpload('document.pdf', 'application/pdf');
}
}
return [
// Use a specific Laravel filesystem disk for credentials (set to null to use explicit credentials)
'disk' => 's3',
// S3 credentials (falls back to disk settings if not specified)
'bucket' => env('S3_UPLOADER_BUCKET'),
'region' => env('S3_UPLOADER_REGION'),
'key' => env('S3_UPLOADER_KEY'),
'secret' => env('S3_UPLOADER_SECRET'),
'endpoint' => env('S3_UPLOADER_ENDPOINT'),
'use_path_style_endpoint' => env('S3_UPLOADER_PATH_STYLE', false),
// Upload settings
'path_prefix' => env('S3_UPLOADER_PATH_PREFIX', 'uploads/multipart'),
'presigned_url_expiration' => env('S3_UPLOADER_URL_EXPIRATION', '+60 minutes'),
// Wrap responses in {success, message, data} envelope
'wrap_responses' => env('S3_UPLOADER_WRAP_RESPONSES', false),
// Route settings
'routes' => [
'enabled' => true,
'prefix' => 'api/s3/multipart',
'middleware' => ['api'],
],
];