We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Google AdWords API v201705 on Phalcon

Not sure if this qualifies as 'beginner', but I certainly do.

I'm trying to install the latest Google AdWords API onto a Phalcon/Ubuntu AWS server. I walked through the instructions, but got nowhere.

I think I'm doing something really wrong. I used Composer, but I'm not sure I launched it in the right directory, and I'm not sure I know how to install it 'right'.

Right now, I put the google files under app/library/googleads-php-lib. But I just get a failed webpage when I try to run a controller that uses the files. The "use Google\AdsApi\AdWords\AdWordsServices;" etc statements cause it to fail to load the page, even if I put a die() right after them. I setup debug with:

error_reporting(E_ALL);        
$debug = new \Phalcon\Debug();
$debug->listen();

And I got some file not found messages, but fileexists returns true for the files if I put that in there?



32.3k
Accepted
answer

Hi @driscojs you have to register the library directory or the namespace

Other way just use composer autoload file and don't move the original library

Good luck



6.6k

I registered the Namespaces in the loader and it is working-ish. I'm having an issue with the API OAuth, but I don't think that's a Phalcon thing. Thanks for resolving a really stressful item for me!

Hi @driscojs you have to register the library directory or the namespace

Other way just use composer autoload file and don't move the original library

Good luck



6.6k

I spoke too soon. I removed the namespace code from the loader.php, in an effort to work aorund the fact that our old Google Adwords API service account won't work with the new API. I tried to follow the Google Ads API install very carefully, and I used composer to install the api to the /app/vendor folder. It created the composer.json file in /app . I added

include APP_PATH . '/vendor/autoload.php';

to my /public/index.php.

Now I get a similar issue to before, like it can't find the files.

Error: Class 'Google\AdsApi\Common\OAuth2TokenBuilder' not found

Help. Help! :)

Hi @driscojs you have to register the library directory or the namespace

Other way just use composer autoload file and don't move the original library

Good luck



6.6k

Aaaaaaaannnd, nevermind. It goes in loader.php.

Hi @driscojs you have to register the library directory or the namespace

Other way just use composer autoload file and don't move the original library

Good luck