I'm using Abraham's twitteroauth
library along with tmhOAuth
library to implement Twitter OAuth. Here's a part of my twitteroauth.php
file stored inside my project directory.
twitteroauth.php
<?php
/**
* The most popular PHP library for use with the Twitter OAuth REST API.
*
* @license MIT
*/
/*namespace twitteroauthm\src\TwitterOAuth;
use twitteroauthm\src\TwitterOAuth;
use twitteroauthm\src\Util\JsonDecoder;
*/
require_once("twitteroauthm/autoload.php");
require_once("twitteroauthm/src/TwitterOAuth.php");
//use twitteroauthm\src\TwitterOAuth;
//require_once("twitteroauthm/src/Config.php");
/**
* TwitterOAuth class for interacting with the Twitter API.
*
* @author Abraham Williams <abraham@abrah.am>
*/
class TwitterOAuth extends Config
{...
However, this is the error I'm encountering:
Fatal error: Class 'Config' not found in /opt/lampp/htdocs/tmhOAuth-master/twitteroauth.php on line 25
I'm sharing a few screenshots below to better elaborate on my current file structure in my project directory:
As evident from the above file structure, I'm pretty sure that I have included all the required files into my twitteroauth.php
file. Then why is class Config
not found?
I did some digging on the Internet, and seems like I need to use something known as a composer to load other libraries which my project depends on. I have installed the composer.phar
file in my project directory (refer screenshots), but I'm not able to figure out how to go about solving the error that I'm encountering.
Can this be solved without the use of a composer? Maybe there's something wrong with my code? Any help would be highly appreciated. Thanks.
PS: When I remove all my comments from the original file, like this:
<?php
/**
* The most popular PHP library for use with the Twitter OAuth REST API.
*
* @license MIT
*/
namespace twitteroauthm\src\TwitterOAuth;
use twitteroauthm\src\TwitterOAuth;
use twitteroauthm\src\Util\JsonDecoder;
require_once("twitteroauthm/autoload.php");
require_once("twitteroauthm/src/TwitterOAuth.php");
use twitteroauthm\src\TwitterOAuth;
//require_once("twitteroauthm/src/Config.php");
/**
* TwitterOAuth class for interacting with the Twitter API.
*
* @author Abraham Williams <abraham@abrah.am>
*/
class TwitterOAuth extends Config
{
I get the following error:
Fatal error: Cannot use twitteroauthm\src\TwitterOAuth as TwitterOAuth because the name is already in use in /opt/lampp/htdocs/tmhOAuth-master/twitteroauth.php on line 15