I need to use google-api-php-client.To do this, I added the Google github repository to my composer.json
"repositories": [ { "type": "package", "package": { "name": "google/google-api-php-client", "version": "dev-master", "source": { "type": "git", "url": "https://github.com/google/google-api-php-client.git", "reference": "master" }, "autoload" :{ "classmap": ["src"] } } } ]
...
"require" : { ... "google/google-api-php-client": "dev-master" }
Everything is installed correctly, and I have the following directory structure:
/vendor /google /google-api-php-client /examples /src /Google Client.php
When I create an object in my controller, follow these steps:
$client = new \Google_Client();
Found the way and class. However, I get the following error:
ContextErrorException: Warning: require_once(Google/Auth/AssertionCredentials.php): failed to open stream: No such file or directory in /Users/etienne/Developpement/Ima-Tech/Clients/lesoptions/vendor/google/google-api-php-client/src/Google/Client.php line 18
In my Client.php file, I have the following at the beginning of the file:
require_once 'Google/Auth/AssertionCredentials.php';
If I changed the line to:
require_once 'Auth/AssertionCredentials.php';
everything works fine for this inclusion. However, I do not want to change every require_once in every google-api-php-client project file. I'm sure there is a way to change the inclusion path or something, so I wonder how can I say that the Google namespace is the current directory?
Edit 1: I assume this could be because this project (google-api-php-client) does not use namespaces ...