Comments (12)
Which version of Laravel are you using ?
Have you added the provider and alias ?
Did you publish the config ?
from twitter.
I use Laravel 4.2,
Ya i have added the provider and alias, and have published the config. All your instruction to install i've followed.
here is my composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.2.",
"facebook/php-sdk-v4": "4.0.",
"thujohn/twitter": "~2.0"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
],
"psr-0" : {
"App" : "app/src"
}
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev",
"require-dev": {
"way/generators": "~2.0"
}
}
from twitter.
Can you post your code ?
from twitter.
I have the same problem, do you have some solution? Thank you.
ErrorException in Twitter.php line 56:
Undefined index: ttwitter::config
from twitter.
Can you post your code ?
from twitter.
I found a mistake in my own code. It works great... Thx..
from twitter.
Same problem here..
published config, providers added.. It actually used to work a while back.
My code:
function __construct(Tweet $twitterAPI, CLImate $climate)
{
$this->twitterAPI = $twitterAPI;
$this->climate = $climate;
}
public function fire(BeanstalkdJob $job, $data)
{
$this->climate->info('Posting to twitter!');
// get args
$ss = $data['ss'];
$episode_id = $data['episode_id'];
// get necessary fields
$episode = \Episode::find($episode_id)->with('Show')->get();;
$number = $episode->episode_number;
$slug = $episode->show->slug;
// generate url and message
$url = URL::route('shows.episode.show', [$slug, $number, $episode->id]);
$url = str_ireplace('.dev', '.com', $url);
$message = $episode->present()->title() . ' posted! #anime #ecchi ' . $url;
// Post media with screenshot
if ($ss) {
$screenshot = File::get($episode->present()->screenshot('large', true, true));
$response = $this->twitterAPI->postTweetMedia(['status' => $message, 'media[]' => $screenshot]);
$this->climate->info('Posted with screenshot: ' . $message);
Log::info('Posted to twitter with screenshot!' . "\n", ['response' => $response]);
} else {
$response = $this->twitterAPI->postTweet(['status' => $message]);
Log::info('Posted to twitter!' . "\n", ['response' => $response]);
}
// Save in database that we have posted this to twitter!
$episode->posted_to_twitter = 1;
$episode->save();
$job->delete();
}
Apparently I can't use dependancy injection? It works fine with the facade..
Also this:
[Exception]
[64] The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.
from twitter.
@Ortix92 I'm encountering the same probably when trying to inject Twitter
with dependency injection, works fine as a facade though.
ErrorException in Twitter.php line 56:
Undefined index: ttwitter::config
from twitter.
Same issue as @nickdenardis I had to use the Facade to use this, using dependency injection threw the
ErrorException in Twitter.php line 56:
Undefined index: ttwitter::config
from twitter.
I had this issue also
from twitter.
This package is simply not compatible with dependency injection, which is really unfortunate. The way around this is to use the facade.
from twitter.
Closing this due to inactivity. Please let me know if you are still having an issue and i'll reopen.
from twitter.
Related Issues (20)
- Laravel 5.7 Please Provide installation steps
- [324] Tweet must not have more than 4 mediaIds HOT 1
- Getting an error when installing in laravel 9.2 HOT 1
- Why empty array is required for: Twitter::getTweet(12345678911, []) ? HOT 1
- Cant post thread
- twitter postTwitter method doesn't work in laravel 9 HOT 1
- Media not uploaded
- getTweet() params not work for ApiV1
- Not installable with Laravel 9.38.0 HOT 3
- How to get tweets with more than 1000 likes?
- will be used.
- Instructions for login via v2? HOT 7
- Unable to install the package with Laravel 9.x HOT 1
- Issue with composer require atymic/twitter "3.1.16"
- How can i use this API end point `POST /2/tweets`
- v2 api getListSubscriptions?
- Error: When authenticating requests to the Twitter API v2 endpoints, you must use keys and to (truncated...) HOT 4
- Laravel 10 php 8.1 HOT 1
- No publishable resources for tag [] HOT 4
- Non static method issue HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twitter.