Reputation: 11
I followed the instructions to install this package:
https://github.com/embedly/embedly-php#installing
In my code I did:
$api = new Embedly\Embedly(array('user_agent' => 'Mozilla/5.0 (compatible; mytestapp/1.0)'));
$objs = $api->oembed('http://www.bbc.com/news/world-latin-america-37077172?ns_mchannel=social&ns_campaign=bbc_breaking&ns_source=twitter&ns_linkname=news_central');
print_r($objs);
But I get this error:
Class 'Embedly\Embedly' not found
What am I missing? Do I have to put something in the provider/alias? If so, I don't know what. I'm using Laravel 5.2.
Upvotes: 1
Views: 1409
Reputation: 413
Just add another '\' at the beginning like this:
$api = new \Embedly\Embedly(...) ;
Upvotes: -1
Reputation: 24280
I guess you just followed README, which was missing line for composer. I've added that in PR.
To explain that, Composer handles all your autoloading and dependencies. To enable that explicitly, you need to include it's autoload file, where all this happens.
Just begin your index.php
(or container) file with:
<?php
require_once __DIR__ . '/vendor/autoload.php';
// your code
Upvotes: 3