Reputation: 1328
I'm creating a web application, using the Amazon SDK 2.5.2. It uses the modular HMVC approach with codeigniter.
I've successfully used the SDK 1.x up to this point but really want to switch to the newest version.
The site says you could install via composer
(a complete nightmare in itself; curl
doesn't work correctly on the server, running commandline php doesn't either. I've tried everything!), via zip
( After I upload all the files I have no idea what to do next), PEAR
(I don't want to go there) and via Phar
. The last option sounds the best in my situation (apart from Composer
which, as I said, is not going to work). I have put the phar
in the libraries
folder and when requiring it from a normal PHP
file and then use
ing it:
// Get the complete API
require 'aws.phar';
// Use the API
use Aws\Common\Aws;
use Aws\S3\S3Client;
There is no problem. I get to use all the functions and everything just works.
However, when require
ing from a controller or model and then use
ing it, codeigniter returns the following error:
unexpected 'use' (T_USE)
I think this has to do with the HMVC structure or codeigniter in general, but as there is no real documentation on it I'm hoping there is someone here who knows what to do next.
Upvotes: 1
Views: 1348
Reputation: 6945
You can only use use
in the global scope, or inside a namespace. You cannot declare use
inside a class, method, function or anything else.
http://www.php.net/manual/en/language.namespaces.importing.php
Upvotes: 2