Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Service_Twitter Component Proposal

Proposed Component Name Zend_Service_Twitter
Developer Notes
Proposers Matthew Weier O'Phinney and Jon Whitcraft
Revision 1.1 - 25 October 2007: Initial proposal creation (wiki revision: 11)

Table of Contents

1. Overview

Zend_Service_Twitter is a full implementation of the Twitter API.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will implement the full Twitter API.
  • This component should namespace the various API methods according to the groupings in the Twitter API documentation.
  • This component will allow re-using an object with multiple user/pass combinations.
  • This component will use a single format for all return values.

4. Dependencies on Other Framework Components

  • Zend_Rest_Client
  • Zend_Service_Exception

5. Theory of Operation

Zend_Service_Twitter will allow a developer to interact with the Twitter API, supporting such actions as updating status, retrieving status lists, sending and receiving direct messages, and creating and removing friendship status. To simplify operation, all methods are namespaced according to the various method groupings on the official API documentation.

6. Milestones / Tasks

  • Milestone 1: [DONE] Design notes will be published here
  • Milestone 2: Working prototype checked into the incubator supporting use cases
  • Milestone 3: Unit tests exist, work, and are checked into SVN.
  • Milestone 4: Initial documentation exists.

7. Class Index

  • Zend_Service_Twitter
  • Zend_Service_Twitter_Search
  • Zend_Service_TWitter_Exception

8. Use Cases


9. Class Skeletons



Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Oct 25, 2007

    <p>At the time of writing, the Twitter engineers are working on an additional authentication scheme similar to Google's AuthSub or Flickr's API Authentication. This will have the added benefit of registering third-party applications to better promote them on the site. The Development Talk group will be notified when this authentication scheme is ready for testing. Note that this new authentication scheme will be optional, not mandatory, once available.</p></blockquote>

    <p>From what I hear, Twitter will implement OpenID/OAuth - for which a proposal is in the works. Personally, I find this a lot more interesting than standard username/password authorization because for the user this requires a lot of trust to hand out than the other. I know they are no specifics yet, but I am asking anyway if you e.g. contacted twitter about it.</p>

    <p>This aside, I like your __get() and __set() usage. Makes sense to me. <ac:emoticon ac:name="smile" /></p>

    1. Oct 25, 2007

      <p>I haven't contacted them about it as of yet, but was aware of the upcoming authentication changes. I'll address those in Zend_Service_Twitter once they have confirmed what they will use.</p>

      1. Oct 25, 2007

        <p>Looks like Pádraic answered that one. Then I would like to see that right away. <ac:emoticon ac:name="smile" /></p>

        1. Oct 26, 2007

          <p>I can't really address it until we have OAuth in the tree. However, I'll try and make it flexible enough that I can add in that support once we have it available.</p>

  2. Oct 25, 2007

    <p>It looks great <ac:emoticon ac:name="smile" />. And it's a service I'd love to see implemented.</p>

    <p>On the authorisation scheme, it was confirmed in mid October as OAuth Core 1.0 using the HMAC-SHA1 method for signing messages (we have HMAC in Incubator <ac:emoticon ac:name="wink" />). They already have a Token Provider up and running, and users are able to generate unique Tokens for each application they intend authorising. So the scheme is in operation right now. I know Ed Finkler got an ASAP message for his Spaz AIR client about OAuth (haven't seen a Javascript implementation just yet).</p>

    <p>I won't be implementing the Zend_Service_OAuth proposal until mid-November so I wouldn't let it hold you up - make it a future feature maybe. A Consumer is not very complex though, the main thing is that the User needs to interact with to give their consent in granting initial authorisation (you may smell a backend datastore). You may want to consider such a server trip (and redirect back) in terms of how a final Service component would work API wise. Some users would need it (OpenID), others might still opt for the username/password.</p>

    1. Oct 26, 2007

      <p>Can you give a link to information on how twitter will be using OAuth? That will help me as I track development.</p>

  3. Jan 19, 2008

    <ac:macro ac:name="unmigrated-wiki-markup"><ac:plain-text-body><![CDATA[I have the feeling that the method names are far from being optimal. Most of them really feel like strangers. This is strange because even the API methods are not called that way. For example statusUpdate() should of course be Zend_Service_Twitter::updateStatus() etc. pp.

    I wrote a service client for twitter too. What I did different was the encapsulation of the API results. In my implementation I have a client-, user-, and tweet-object. The tweet-object always contains a user (the author of the tweet). When I call getFriendsTimeline() I receive a list of tweets, each of the tweets having a user object attached (for performance reasons the client acts as a flyweight, to make sure every unique user and every unique tweet is just instanciated once). The API flow is really natural then:

    $client = new TwitterClient($user, $password);
    $timeline = $client->getFriendsTimeline();
    foreach ($timline as $tweet) {
    echo "{$tweet->getUser()>getName()} says: {$tweet>getText()}";

    Unknown macro: {/code}


  4. Sep 21, 2008

    <p>After talking with Matthew at ZendCon08 about the Twitter Service and his lack of being able to work on it, he and I agreed that someone else should take over the development of it.  That is going to be me.  I have Matthew's code and I have gotten it working again with the updated API.</p>

    <p>I will continue to post my status here as I get more done.</p>

  5. Sep 25, 2008

    <p>Good news!</p>

    <p>To update a prior comment I made - Twitter OAuth support will turn up late this year, or early next year. Definitely not on the cards in the short term, but still worth noting for when it makes an eventual second debut. Zend_Oauth should be finished and released well before that happens.</p>

    <p>Look forward to seeing this in a ZF release <ac:emoticon ac:name="wink" />.</p>

    1. Sep 25, 2008

      <p>That is good news Pádraic. I will keep an eye out for it and update this class when it happens.</p>

  6. Sep 25, 2008

    <p>If you want an updated class and tests you can download it here <a href=""></a>. I have about 70% code coverage in the test and I hope to have more done by mid-day tomorrow. I'm also going to implement a Zend_Service_Twitter_Search so you can query the search API but that will be next week.</p>

    1. Sep 29, 2008

      <p>I have just made this aviable on located here: <a href=""></a></p>

  7. Oct 19, 2008

    <p>Jon, Matthew,</p>

    <p>Keep me informed on further development of this component, because for my current project I need to implement the services like Twitter, Pounce, and</p>

    <p>I know that is implementing the <a href="" title="Open Network Service">Open Network Service</a> and the <a href="" title="The OpenMicroBlogging site">OpenMicroBlogging</a> Protocol, so I wanted to create an abstract class for these protocols and a specific component that implements it.</p>

    <p>If any of you is interested, I will put the proposal online as soon as I have some decent material ready for testing.</p>

  8. Oct 28, 2008

    <p>What is the status of this proposal? It looks pretty complete, and people seem to be using it already. If it's ready, let's get it in to a release.</p>

    1. Oct 29, 2008

      <p>I have updated the code on the page and move it to read for recommendation. If you want the most up to date code it is located here for now: <a class="external-link" href=""></a> I'm hoping to move into the incubator by Monday of next week.</p>

  9. Oct 31, 2008

    <ac:macro ac:name="note"><ac:parameter ac:name="title">Zend Acceptance</ac:parameter><ac:rich-text-body>
    <p>This proposal is accepted for immediate development in the standard incubator.</p>

    <p>One suggestion is to have the constructor accept an array and/or Zend_Config object of arguments, to allow flexibility for additional arguments in the future.</p></ac:rich-text-body></ac:macro>