Issue
I am successfully installed embed/embed inside my project. Getting error Fatal error: Class 'Embed' not found, anyone tell me how to fix this problem.
class Home extends MY_Controller {
public function og_test()
{
//Load any url:
$info = Embed::create('https://www.youtube.com/watch?v=PP1xn5wHtxE');
//Get content info
$info->title; //The page title
$info->description; //The page description
$info->url; //The canonical url
$info->type; //The page type (link, video, image, rich)
$info->tags; //The page keywords (tags)
}
}
Solution
Install your repository('composer require embed/embed') via composer on your project root/home
, where you can find default index.php
.
Go to application>config>Config.php
.
Look for $config['composer_autoload']
.
It will be set to FALSE
in default, just change it to TRUE
.
Use use Embed\Embed;
in your controller.
Now try using it in your controller it should be accessible.
use Embed\Embed;
class Home extends MY_Controller {
public function og_test()
{
//Load any url:
$info = Embed::create('https://www.youtube.com/watch?v=PP1xn5wHtxE');
//Get content info
echo $info->title; //The page title
echo $info->description; //The page description
echo $info->url; //The canonical url
echo $info->type; //The page type (link, video, image, rich)
echo $info->tags; //The page keywords (tags)
}
}
Answered By - Sohail Haider
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.