I guess this is more of a general namespacing / composer issue but basically I have the AWS php sdk installed via composer. I'm trying to write a task that will list all the files in a bucket but I keep getting a class not found, this file is found in my tasks file
Assuming your use statement is correct, I think the problem is that "namespace" must be the first executable statement in a PHP file, and "use" most come after that?
One of the reasons I rarely use "use" statements these days. Just creates no way of seeing what is happening or what is being called from where (guessing it also removes further class conflicts).
It's not much harder to call \Aws\S3\S3Client\S3Client::factory() (particularly in this case where there is only 1 reference) and this way it reads cleanly when you revisit your code later on.
Thanks for the replies, yeah what ended up working was putting namespace first, and I dont know how I didn't know I can just use the full class path to call the class like @hrabbit suggested.
The reason all core classes are aliased is that it makes it easy to extend them. If you use the core class directly, you bypass any extension and that can have consequences.