Skip to content

Commit 100a8e8

Browse files
committed
Finish 3.1.0
2 parents a01d408 + 1eb6eca commit 100a8e8

9 files changed

+242
-29
lines changed

CHANGELOG

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
codebird-php - changelog
22
========================
33

4+
3.1.0 (2016-02-15)
5+
+ #143 Add support for proxy types
6+
+ #152 Throw Exception on failed remote media download
7+
+ Add REST API POST statuses/unretweet/:id
8+
+ Add Ads API GET insights/keywords/search
9+
+ #151 Avoid JSON_BIGINT_AS_STRING errors
10+
- Fix typo in changelog
11+
412
3.0.0 (2016-01-01)
513
+ Add unit testing suite
614
+ #32 Support Twitter Streaming API

README.md

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ GNU General Public License for more details.
1717
You should have received a copy of the GNU General Public License
1818
along with this program. If not, see <http://www.gnu.org/licenses/>.
1919

20-
[![Coverage Status](https://img.shields.io/coveralls/jublonet/codebird-php/master.svg)](https://coveralls.io/github/jublonet/codebird-php?branch=master)
21-
[![Travis Status](https://img.shields.io/travis/jublonet/codebird-php/master.svg)](https://travis-ci.org/jublonet/codebird-php/branches)
20+
[![Coverage Status](https://img.shields.io/coveralls/jublonet/codebird-php/develop.svg)](https://coveralls.io/github/jublonet/codebird-php?branch=develop)
21+
[![Travis Status](https://img.shields.io/travis/jublonet/codebird-php/develop.svg)](https://travis-ci.org/jublonet/codebird-php/branches)
2222

2323
### Requirements
2424

@@ -168,11 +168,11 @@ print_r($reply);
168168
Tweeting is as easy as this:
169169

170170
```php
171-
$reply = $cb->statuses_update('status=Whohoo, I just tweeted!');
171+
$reply = $cb->statuses_update('status=Whohoo, I just Tweeted!');
172172
```
173173

174174
:warning: *Make sure to urlencode any parameter values that contain
175-
query-reserved characters, like tweeting the `&` sign:*
175+
query-reserved characters, like Tweeting the `&` sign:*
176176

177177
```php
178178
$reply = $cb->statuses_update('status=' . urlencode('Fish & chips'));
@@ -205,7 +205,7 @@ $params = [
205205
];
206206
$reply = $cb->users_show($params);
207207
```
208-
This is the [resulting tweet](https://twitter.com/LarryMcTweet/status/482239971399835648)
208+
This is the [resulting Tweet](https://twitter.com/LarryMcTweet/status/482239971399835648)
209209
sent with the code above.
210210

211211
### Requests with app-only auth
@@ -314,16 +314,15 @@ to ```statuses/update```, like this:
314314
// convert media ids to string list
315315
$media_ids = implode(',', $media_ids);
316316

317-
// send tweet with these medias
317+
// send Tweet with these medias
318318
$reply = $cb->statuses_update([
319319
'status' => 'These are some of my relatives.',
320320
'media_ids' => $media_ids
321321
]);
322322
print_r($reply);
323-
);
324323
```
325324

326-
Here is a [sample tweet](https://twitter.com/LarryMcTweet/status/475276535386365952)
325+
Here is a [sample Tweet](https://twitter.com/LarryMcTweet/status/475276535386365952)
327326
sent with the code above.
328327

329328
More [documentation for uploading media](https://dev.twitter.com/rest/public/uploading-media) is available on the Twitter Developer site.
@@ -353,8 +352,8 @@ You need to perform at least 3 calls to obtain your `media_id` for the video:
353352

354353
1. Send an `INIT` event to get a `media_id` draft.
355354
2. Upload your chunks with `APPEND` events, each one up to 5MB in size.
356-
3. Send a `FINALIZE` event to convert the draft to a ready-to-tweet `media_id`.
357-
4. Post your tweet with video attached.
355+
3. Send a `FINALIZE` event to convert the draft to a ready-to-Tweet `media_id`.
356+
4. Post your Tweet with video attached.
358357

359358
Here’s a sample for video uploads:
360359

@@ -405,7 +404,7 @@ if ($reply->httpstatus < 200 || $reply->httpstatus > 299) {
405404
die();
406405
}
407406

408-
// Now use the media_id in a tweet
407+
// Now use the media_id in a Tweet
409408
$reply = $cb->statuses_update([
410409
'status' => 'Twitter now accepts video uploads.',
411410
'media_ids' => $media_id
@@ -496,7 +495,7 @@ and will always send the correct Content-Type automatically.
496495

497496
Find out more about the [Collections API](https://dev.twitter.com/rest/collections/about) in the Twitter API docs.
498497

499-
Here’s a sample for adding a tweet using that API method:
498+
Here’s a sample for adding a Tweet using that API method:
500499

501500
```php
502501
$reply = $cb->collections_entries_curate([
@@ -706,7 +705,7 @@ stdClass Object
706705
)
707706
```
708707

709-
If you need to get more details, such as the user’s latest tweet,
708+
If you need to get more details, such as the user’s latest Tweet,
710709
you should fetch the complete User Entity. The simplest way to get the
711710
user entity of the currently authenticated user is to use the
712711
```account/verify_credentials``` API method. In Codebird, it works like this:
@@ -840,3 +839,37 @@ You may also use an authenticated proxy. Use the following call:
840839
$cb->setProxy('<host>', '<port>');
841840
$cb->setProxyAuthentication('<username>:<password>');
842841
```
842+
843+
By default, a HTTP proxy is assumed. To use a different proxy type,
844+
use the corresponding [`CURLPROXY_*` constants](http://php.net/curl_setopt), like this:
845+
846+
```php
847+
$cb->setProxy('<host>', '<port>', CURLPROXY_SOCKS5);
848+
```
849+
850+
### …quote a Tweet?
851+
852+
Quoting a Tweet is different from a Retweet because you may add your own text.
853+
The original Tweet will appear below your quote.
854+
To quote a Tweet, add a link to the original Tweet to your quote, like in this sample:
855+
856+
```php
857+
$original_tweet = [
858+
'id_str' => '684483801687392256',
859+
'user' => [
860+
'screen_name' => 'LarryMcTweet'
861+
]
862+
];
863+
$original_tweet = (object) $original_tweet; // sample, get real Tweet from API
864+
865+
$id = $original_tweet->id_str; // use the `id_str` field because of long numbers
866+
$screen_name = $original_tweet->user->screen_name;
867+
868+
// looks like this: https://twitter.com/LarryMcTweet/status/684483801687392256
869+
$url = "https://twitter.com/$screen_name/status/$id";
870+
$text = 'I’d like to quote a Tweet.'; // maximum length = 140 minus 24 (link length) minus 1 space
871+
872+
$reply = $cb->statuses_update([
873+
'status' => "$text $url"
874+
]);
875+
```

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codebird-php",
3-
"version": "3.0.0",
3+
"version": "3.1.0",
44
"homepage": "https://www.jublo.net/projects/codebird/php",
55
"authors": [
66
"Joshua Atkins <joshua.atkins@jublo.net>",

0 commit comments

Comments
 (0)