Search code examples
phplaravelamazon-web-servicesamazon-s3laravel-storage

How to fetch the name of an S3 bucket in Laravel using Storage::disk('s3')


I am trying to fetch the bucket name of my S3 Bucket on AWS. I have it in my environment file, but I wish to use it in my code without fetching it from the environment file or config. Is there any way to fetch this information using Storage::disk('s3')?


Solution

  • I got the bucket name by using this

    Storage::disk('filesystem_name')->getAdapter()->getBucket()