Support the ongoing development of Laravel.io →
Configuration IOC Packages
Last updated 1 year ago.
0

Laravel provides a neat configuration class which is perfectly suited for that kind of tasks. You can just drop a configuration file into the app/config directory.

So in your case you would create a s3.php file in the config directory. Then just return an array with your configuration:

<?php 
return [
	'bucket' => [
		'Bucket' => 'GLOBAL-BUCKET-NAME'
	]
];

Then you can simply use:

$s3->createBucket(Config::get('s3.bucket'));

For more configuration madness check the Docs

Last updated 1 year ago.
0

Or better still, use aws-sdk-php-laravel which is Amazon's own implementation of the PHP SDK for Laravel.

Then you can add your buckets to the config already provided as well as getting a nice Laravel facade to help with your syntax.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.