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
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community