Skip to content

Commit

Permalink
Finish 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mynetx committed Feb 15, 2016
2 parents a01d408 + 1eb6eca commit 100a8e8
Show file tree
Hide file tree
Showing 9 changed files with 242 additions and 29 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
codebird-php - changelog
========================

3.1.0 (2016-02-15)
+ #143 Add support for proxy types
+ #152 Throw Exception on failed remote media download
+ Add REST API POST statuses/unretweet/:id
+ Add Ads API GET insights/keywords/search
+ #151 Avoid JSON_BIGINT_AS_STRING errors
- Fix typo in changelog

3.0.0 (2016-01-01)
+ Add unit testing suite
+ #32 Support Twitter Streaming API
Expand Down
59 changes: 46 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

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

### Requirements

Expand Down Expand Up @@ -168,11 +168,11 @@ print_r($reply);
Tweeting is as easy as this:

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

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

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

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

// send tweet with these medias
// send Tweet with these medias
$reply = $cb->statuses_update([
'status' => 'These are some of my relatives.',
'media_ids' => $media_ids
]);
print_r($reply);
);
```

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

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

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

Here’s a sample for video uploads:

Expand Down Expand Up @@ -405,7 +404,7 @@ if ($reply->httpstatus < 200 || $reply->httpstatus > 299) {
die();
}

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

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

Here’s a sample for adding a tweet using that API method:
Here’s a sample for adding a Tweet using that API method:

```php
$reply = $cb->collections_entries_curate([
Expand Down Expand Up @@ -706,7 +705,7 @@ stdClass Object
)
```

If you need to get more details, such as the user’s latest tweet,
If you need to get more details, such as the user’s latest Tweet,
you should fetch the complete User Entity. The simplest way to get the
user entity of the currently authenticated user is to use the
```account/verify_credentials``` API method. In Codebird, it works like this:
Expand Down Expand Up @@ -840,3 +839,37 @@ You may also use an authenticated proxy. Use the following call:
$cb->setProxy('<host>', '<port>');
$cb->setProxyAuthentication('<username>:<password>');
```

By default, a HTTP proxy is assumed. To use a different proxy type,
use the corresponding [`CURLPROXY_*` constants](http://php.net/curl_setopt), like this:

```php
$cb->setProxy('<host>', '<port>', CURLPROXY_SOCKS5);
```

### …quote a Tweet?

Quoting a Tweet is different from a Retweet because you may add your own text.
The original Tweet will appear below your quote.
To quote a Tweet, add a link to the original Tweet to your quote, like in this sample:

```php
$original_tweet = [
'id_str' => '684483801687392256',
'user' => [
'screen_name' => 'LarryMcTweet'
]
];
$original_tweet = (object) $original_tweet; // sample, get real Tweet from API

$id = $original_tweet->id_str; // use the `id_str` field because of long numbers
$screen_name = $original_tweet->user->screen_name;

// looks like this: https://twitter.com/LarryMcTweet/status/684483801687392256
$url = "https://twitter.com/$screen_name/status/$id";
$text = 'I’d like to quote a Tweet.'; // maximum length = 140 minus 24 (link length) minus 1 space

$reply = $cb->statuses_update([
'status' => "$text $url"
]);
```
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codebird-php",
"version": "3.0.0",
"version": "3.1.0",
"homepage": "https://www.jublo.net/projects/codebird/php",
"authors": [
"Joshua Atkins <joshua.atkins@jublo.net>",
Expand Down
Loading

0 comments on commit 100a8e8

Please sign in to comment.