Skip to content

Commit

Permalink
Merge branch 'release/4.0.0-beta.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mynetx committed Aug 16, 2018
2 parents 100a8e8 + 1434ccc commit df362d8
Show file tree
Hide file tree
Showing 19 changed files with 954 additions and 1,442 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ language: php
sudo: false

php:
- "7.0"
- "5.6"
- "5.5"
- "7.2"
- "7.1"
- hhvm
- nightly

Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
codebird-php - changelog
========================

4.0.0 (not yet released)
+ #161 Update oembed API method endpoint
+ Update to Twitter Ads API Version 1
+ Add Ads API POST tailored_audience_memberships method
+ Add Ads Sandbox API POST accounts method
+ Add Ads Sandbox API POST accounts/:account_id/features method
+ Add Ads Sandbox API POST accounts/:account_id/funding_instruments method
+ Update more Ads API methods
- Fix Ads API batch methods to send JSON body
+ Update Ads API Analytics methods (stats)
+ #177 Add async media/upload calls status by GET
+ Add POST media/metadata/create method
- Fix TON API upload - add additional header parsing
+ Add custom Codebird Exception classes
+ Add Account Activity API methods
+ Add new Direct Messages API
+ Update cacert.pem file
- Remove sunsetting Direct Messages API
- Remove sunsetting Streaming API
- Remove contributor API methods
- Remove deprecated statuses/update_with_media method
- Remove deprecated statuses/update_profile_background_image method

3.1.0 (2016-02-15)
+ #143 Add support for proxy types
+ #152 Throw Exception on failed remote media download
Expand Down
46 changes: 31 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
codebird-php
============
*Easy access to the Twitter REST API, Collections API, Streaming API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.*
*Easy access to the Twitter REST API, Direct Messages API, Account Activity API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.*

Copyright (C) 2010-2016 Jublo Solutions <[email protected]>
Copyright (C) 2010-2018 Jublo Limited <[email protected]>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -17,12 +17,13 @@ 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/>.

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3cd81a521d334648b9958327621a3070)](https://www.codacy.com/app/jublonet/codebird-php?utm_source=github.com&utm_medium=referral&utm_content=jublonet/codebird-php&utm_campaign=badger)
[![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

- PHP 5.5.0 or higher
- PHP 7.1.0 or higher
- OpenSSL extension


Expand Down Expand Up @@ -131,6 +132,13 @@ In this case, you don't need to set the consumer key and secret.
For sending an API request with app-only auth, see the ‘Usage examples’ section.


### A word on your callback URL

Twitter is very restrictive about which URLs may be used for your callback URL.
For example, even the presence of the ‘www’ subdomain must match with the domain
that you specified in the settings of your app at https://developer.twitter.com/en/apps.


Mapping API methods to Codebird function calls
----------------------------------------------

Expand Down Expand Up @@ -240,7 +248,7 @@ The library returns the response HTTP status code, so you can detect rate limits
I suggest you to check if the ```$reply->httpstatus``` property is ```400```
and check with the Twitter API to find out if you are currently being
rate-limited.
See the [Rate Limiting FAQ](https://dev.twitter.com/rest/public/rate-limiting)
See the [Rate Limiting FAQ](https://developer.twitter.com/en/docs/basics/rate-limiting)
for more information.

Unless your return format is JSON, you will receive rate-limiting details
Expand Down Expand Up @@ -325,7 +333,7 @@ print_r($reply);
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.
More [documentation for uploading media](https://developer.twitter.com/en/docs/media/upload-media/overview) is available on the Twitter Developer site.

### Remote files

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

// if you have a field `processing_info` in the reply,
// use the STATUS command to check if the video has finished processing.

// Now use the media_id in a Tweet
$reply = $cb->statuses_update([
'status' => 'Twitter now accepts video uploads.',
Expand All @@ -412,7 +423,7 @@ $reply = $cb->statuses_update([

```

**Find more information about [accepted video formats](https://dev.twitter.com/rest/public/uploading-media#videorecs) in the Twitter Developer docs.**
**Find more information about [accepted media formats](https://developer.twitter.com/en/docs/media/upload-media/uploading-media/media-best-practices) in the Twitter Developer docs.**

:warning: When uploading a video in multiple chunks, you may run into an error `The validation of media ids failed.` even though the `media_id` is correct. This is known. Please check back in the [Twitter community forums](https://twittercommunity.com/tags/video).

Expand Down Expand Up @@ -469,18 +480,22 @@ $cb->setStreamingCallback('some_callback');
$GLOBALS['time_start'] = time();

// Second, start consuming the stream:
$reply = $cb->user();
$reply = $cb->statuses_filter();

// See the *Mapping API methods to Codebird function calls* section for method names.
// $reply = $cb->statuses_filter('track=Windows');
```

Find more information on the [Streaming API](https://dev.twitter.com/streaming/overview)
You should be able to set a timeout for the streaming API using `setTimeout`.
In addition, your callback will receive empty messages if no events occur,
and you should make your function `return true;` in order to cancel the stream.

Find more information on the [Streaming API](https://developer.twitter.com/en/docs/tweets/filter-realtime/overview)
in the developer documentation website.


Twitter Collections API
-----------------------
Twitter Collections, Direct Messages and Account Activity APIs
--------------------------------------------------------------

Collections are a type of timeline that you control and can be hand curated
and/or programmed using an API.
Expand All @@ -490,12 +505,13 @@ often they will be decomposed, efficient objects with information about users,
Tweets, and timelines grouped, simplified, and stripped of unnecessary repetition.

Never care about the OAuth signing specialities and the JSON POST body
for POST collections/entries/curate.json. Codebird takes off the work for you
for POST and PUT calls to these special APIs. Codebird takes off the work for you
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.
Find out more about the [Collections API](https://developer.twitter.com/en/docs/tweets/curate-a-collection/overview/about_collections) in the Twitter API docs.
More information on the [Direct Messages API](https://developer.twitter.com/en/docs/direct-messages/api-features) and the [Account Activity API](https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/overview) is available there as well.

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

```php
$reply = $cb->collections_entries_curate([
Expand All @@ -511,7 +527,7 @@ var_dump($reply);
TON (Twitter Object Nest) API
-----------------------------

The [TON (Twitter Object Nest) API](https://dev.twitter.com/rest/ton) allows implementers to upload media and various assets to Twitter.
The [TON (Twitter Object Nest) API](https://developer.twitter.com/en/docs/ads/audiences/overview/ton-upload.html) allows implementers to upload media and various assets to Twitter.
The TON API supports non-resumable and resumable upload methods based on the size of the file.
For files less than 64MB, non-resumable may be used. For files greater than or equal to 64MB,
resumable must be used. Resumable uploads require chunk sizes of less than 64MB.
Expand Down Expand Up @@ -597,7 +613,7 @@ fclose($fp);
Twitter Ads API
---------------

The [Twitter Ads API](https://dev.twitter.com/ads/overview) allows partners to
The [Twitter Ads API](https://developer.twitter.com/en/docs/ads/general/overview) allows partners to
integrate with the Twitter advertising platform in their own advertising solutions.
Selected partners have the ability to create custom tools to manage and execute
Twitter Ad campaigns.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Joshua Atkins <[email protected]>",
"J.M. <[email protected]>"
],
"description": "Easy access to the Twitter REST API, Collections API, Streaming API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.",
"description": "Easy access to the Twitter REST, Direct Messages, Account Activity, TON (Object Nest) and Twitter Ads API — all from one PHP library.",
"main": "src/codebird.php",
"moduleType": [],
"keywords": [
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jublonet/codebird-php",
"description" : "Easy access to the Twitter REST API, Collections API, Streaming API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.",
"description" : "Easy access to the Twitter REST API, Direct Messages API, Account Activity API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.",
"keywords": [
"Twitter",
"API",
Expand Down Expand Up @@ -38,8 +38,8 @@
"classmap": ["src/"]
},
"require-dev": {
"satooshi/php-coveralls": ">=0.6",
"phpunit/phpunit": ">=3.7",
"php-coveralls/php-coveralls": ">=0.6",
"phpunit/phpunit": ">=7.3",
"squizlabs/php_codesniffer": "2.*"
}
}
Loading

0 comments on commit df362d8

Please sign in to comment.