Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot require a file in Symfony from google-api-php-client
    text
    copied!<p>I need to use google-api-php-client.To do so, I added Google's github repository to my composer.json</p> <pre><code>"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"] } } } ] </code></pre> <p>...</p> <pre><code>"require" : { ... "google/google-api-php-client": "dev-master" } </code></pre> <p>Everything is installed properly and I have the following directory structure:</p> <pre><code>/vendor /google /google-api-php-client /examples /src /Google Client.php </code></pre> <p>When I create an object in my Controller, doing the following :</p> <pre><code>$client = new \Google_Client(); </code></pre> <p>The path and the class are found. However, I get the following error :</p> <pre><code>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 </code></pre> <p>In my Client.php file, I have the following at the beginning of the file:</p> <pre><code>require_once 'Google/Auth/AssertionCredentials.php'; </code></pre> <p>If I change the line to :</p> <pre><code>require_once 'Auth/AssertionCredentials.php'; </code></pre> <p>everything works fine for that inclusion. However, I don't want to change each <code>require_once</code> in every file of the google-api-php-client project. I'm sure there is a way to change the inclusion path or something therefore I'm wondering how can I tell that the namespace "Google" is the current directory ? </p> <p><strong>Edit 1 :</strong> I'm guessing that this may be caused because this project (google-api-php-client) does not use namespaces...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload