承接 baspa/laravel-s3-uploader 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

baspa/laravel-s3-uploader

Composer 安装命令:

composer require baspa/laravel-s3-uploader

包简介

Upload local files and folders to S3 from an Artisan command

README 文档

README

Latest Version on Packagist GitHub Tests Action Status PHPStan Coverage Total Downloads

Upload a local folder to S3 (or any S3-compatible storage) with a single Artisan command. It reads your existing S3 credentials straight from your application's filesystem configuration, walks a directory recursively, and streams every file to a destination prefix on the bucket.

php artisan s3:upload storage/app/exports backups/2026

Installation

Install the package via composer:

composer require baspa/laravel-s3-uploader

This package uploads through a standard Laravel filesystem disk, so you also need the S3 driver in your application (most Laravel apps already have it):

composer require league/flysystem-aws-s3-v3 "^3.0"

Optionally publish the config file:

php artisan vendor:publish --tag="laravel-s3-uploader-config"

Configuration

The package uploads to a disk defined in your application's config/filesystems.php. By default it uses the s3 disk, which is configured through the usual environment variables:

AWS_ACCESS_KEY_ID=your-key
AWS_SECRET_ACCESS_KEY=your-secret
AWS_DEFAULT_REGION=eu-central-1
AWS_BUCKET=your-bucket

S3-compatible providers (MinIO, DigitalOcean Spaces, Cloudflare R2, …) work too — just set AWS_ENDPOINT on the s3 disk as you normally would.

Want to point the package at a different disk? Publish the config and change the disk name, or set it in your .env:

S3_UPLOADER_DISK=backups

The published config/s3-uploader.php:

return [
    'disk' => env('S3_UPLOADER_DISK', 's3'),
];

Usage

php artisan s3:upload {source} {destination}
Argument / option Description
source The local directory to upload.
destination The destination folder (prefix) on the disk. Use "" to upload to the bucket root.
--disk= Upload to a specific disk instead of the configured default.
--force Overwrite files that already exist on the disk. Without it, existing files are skipped.
--dry-run Show what would be uploaded without writing anything.

The directory is walked recursively and the folder structure is preserved under the destination prefix. For example, uploading a folder that contains sub/report.pdf to backups/2026 stores it at backups/2026/sub/report.pdf.

Examples

Upload a folder, skipping anything already in the bucket:

php artisan s3:upload storage/app/exports backups/2026

Re-upload everything, overwriting existing objects:

php artisan s3:upload storage/app/exports backups/2026 --force

Preview the upload without touching S3:

php artisan s3:upload storage/app/exports backups/2026 --dry-run

Upload to a different disk:

php artisan s3:upload storage/app/exports backups/2026 --disk=spaces

The command shows a progress bar while uploading and prints a summary afterwards, e.g. Uploaded: 12, Skipped: 3, Failed: 0. It exits with a non-zero status code if any file failed to upload, so it is safe to use in scripts and CI.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固