This package contains three command line commands for Laravel to upload files to Amazon S3. This will allow you to schedule backups either as cron jobs or via Laravel's scheduler or to backup files from the command line.
composer require escuccim/s3backup
Then register the components in /config/app.php:
Add the following to the 'providers' array:
Escuccim\S3Backup\S3BackupServiceProvider::class,
Aws\Laravel\AwsServiceProvider::class,
You must add the following values to your .env file:
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=
AWS_BUCKET=
These values are used to login to your AWS account and upload the files.
Currently three separate commands are created: to upload a single file, to upload an entire directory, and to dump a MySQL database and upload the dump file. Note that you should not use leading or trailing "/"s on any of the paths.
The followwing command will execute a MySQL dump and then upload the file to S3.
php artisan backup:db {--path=} {--db=} {--user=} {--dest=} {--keep} {--p} {--pass=}
The options are as follows:
If you do not pass any parameters everything will be taken from the .env file.
The following command will upload a single file to S3:
php artisan backup:file [file] [--dest=location to upload file to]
The parameters are as follows:
The following command will recursively upload a directory and its subdirectories to S3:
php artisan backup:dir [path] [--dest=location to upload file to] [--ext=file extension]
The parameters are as follows:
As mentioned above, you must add the following values to your .env file:
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=
AWS_BUCKET=
There is no other configuration for this package.