A require statement inside a view

I need to “require” something from my vendors folder. It’s for integration with the Aweber api. However, I’m not sure how to specify a path into the vendors folder.

This is my views php file.




require_once('aweber\aweber_api\aweber_api.php');



Is what I’m trying to do.

I tried using


use aweber\aweber\aweber_api\aweber_api;

But this didn’t work for me.

According to the composer.json for this project it should be


"aweber/aweber":"*"

Judging from what’s in the composer configuration file for that project and the example provided you shouldn’t need to require or use anything.

Because of the way that Composer autoloads, you simply new whatever object it is that you need.


new AWeberAPI(whatever..

Oh, sorry. I don’t know why I thought it’s about composer…

Like @jacmoe said call new AWeberAPI. Try to use:


use aweber\aweber\AWeberAPI;

Tried that and I get this error:


Class 'aweber\aweber\AWeberAPI' not found

Try not using it.

Just [i]‘new AWeberAPI(arguments)’

[/i]However, I must say that the API seems to suck big time - perhaps there is a better alternative on Packagist?

When I do that it still says class not found.

Yeah the Aweber API does suck. I see 3 other packages on packagist, but not sure if they’d be any better. The demo code uses the “require” statement, which is the issue we’re facing here. If only they had some demo code I could work with…

OK - this might be the solution:

Seems like you need to perform some jerry-rigging yourself. :)