I followed his readme and I have done composer dump-autoload a million times, but still I receive an error. Don’t know what i am making wrong. I am trying to use v2 version of twitter api. Please help me anyone.
In config/app.php:
'providers' => [
...
AtymicTwitterServiceProviderLaravelServiceProvider::class,
],
'aliases' => [
...
'Twitter' => AtymicTwitterFacadeTwitter::class,
],
In my controller:
namespace AppHttpControllers;
use IlluminateHttpRequest;
use Twitter;
class HomeController extends Controller {
public function index() {
$tweets = Twitter::getUserTimeline([
'screen_name' => 'xxxxxxx',
'count' => 10,
'format' => 'json'
]);
dd($tweets);
return view('home');
}
public function about() {
return view('about');
}
}
But I am getting this error:
Error
Call to undefined method AtymicTwitterServiceAccessor::getUserTimeline()
3
Answers
Look like you have to import facade
Instead of this
Import this
If you are using alias then run following command
Please look to the twitter api version which you have defined in the .env. you may need to use 1.1 and you are using v2
I think
getUserTimeLine
is available for version 1.1, and I think as the readme says you can useuserTweets
for v2