laravel-filesystem

Laravel 5: How do you copy a local file to Amazon S3?

江枫思渺然 提交于 2019-12-04 08:13:16
I'm writing code in Laravel 5 to periodically backup a MySQL database. My code thus far looks like this: $filename = 'database_backup_'.date('G_a_m_d_y').'.sql'; $destination = storage_path() . '/backups/'; $database = \Config::get('database.connections.mysql.database'); $username = \Config::get('database.connections.mysql.username'); $password = \Config::get('database.connections.mysql.password'); $sql = "mysqldump $database --password=$password --user=$username --single-transaction >$destination" . $filename; $result = exec($sql, $output); // TODO: check $result // Copy database dump to S3