Basecamp: PHP Class In Progress – Feedback Needed

I have begun working on a Basecamp PHP class (using cURL). I can certainly add in many of the basics, but I would love some feedback as to what YOU would like it to do. So, please write comments with ideas/wishlist of features that you would like to see in a Basecamp PHP class.

At this point (not *quite* ready for a release), you pass the object your url and login credentials to create the object. From that point, you can get information very easily on people, projects, messages, todos, etc. (returned as an xml object) from which you can sort through to find the data you need.

I haven’t yet created the functionality to post data – but that won’t be difficult, as I already know how to do it.

I’ll hope to have a release within the next couple weeks (hopefully). I’ll create a static page for it similar to my Magento Product Import Script.

Update (11.16.08 – 9pm): I have the class successfully posting comments (to any resource), and posting new messages is in the works. Notifications and file attachments are also on the works.

Update (11.16.08 – 11:20pm): Successfully posting messages to any given project id, category id, and you can easily set if a message is private or not.

This entry was posted in PHP, Web Apps. Bookmark the permalink.

24 Responses to Basecamp: PHP Class In Progress – Feedback Needed

  1. ianemv says:

    We’re using CakePHP framework and we find it easy to integrate Basecamp to our app. Using CakePHP’s Httpsocket and XML, it was indeed a heads-up.

  2. Edvin says:

    Where do you download?

    • Josh Pratt says:

      Edvin: I actually stopped development a long time ago. Basecamp doesn’t really seem interested in further developing their API (which is very disappointing), so I stopped caring to really do much with the API, as it is quite limiting. They’ll also admit that some of the API responses vary in format as well, making a nice class more difficult to create.

  3. Guillermo Lopez says:

    Hi Josh,
    It’s great to see that you have classes for PHP to use Basecamp. My company uses Basecamp at a regular basis and there is some functionality that we want to take advantage of that Basecamp doesn’t provide.

    So we are going to be using the Basecamp Api with PHP. And I have a few questions for you.

    Our server currently has XAMPP installed. Using your class will make most of my work easier. Do I need to install PHP/cURL? Or a better question will be: Do you suggest I install cURL?

    I saw some of your scripts in the Basecamp Forums and they use curl, but it might seem that your classes does not.

    BTW.: I’m looking forward on the Time tracking class on your to-dos ;).


  4. Ross Haggart says:

    Hi i’ve used your wrapper class successfully on a local xampp server, but when i move over to the live server i’m getting a String could not be parsed as XML error. I think it’s the configuration apache/php but no idea what. SimpleXMLElement is enabled and i noticed some comments about the encoding, but no joy. Any help would be appreciated.


  5. Erin says:

    Hi Josh,

    Here is one more for you. Is there a way to get all projects associated with a person, or all people associated with a project?


  6. Daniel says:

    I don’t know why but for me doesn’t work. i’ve try to post a message and a to do but nothing happens.
    /// sending email to basecamp
    $bc = new Basecamp(‘’,’username’,’pass’);
    $bc->set_project_id(487676); // required
    $bc->set_category_id(74543345); // required
    $bc->set_is_private(0); // optional – (0) or don’t set it for non-private
    $bc->post_message(‘New design’,’some text’);
    // Resource ID (integer) for any message, to-do list, or milestone
    // Resource Type [posts|milestones|todo_items]
    i’ve downloaded the * @version 1.11 where is the mistake?

  7. Michael Nass says:


    Great work on this. Thanks a ton!

    Curious if you’ve heard anything back from 37Signals on the XML response from Messages, etc… Seems odd that they don’t return anything.

    I’m working on something with your class so was really hoping to have 1.2 but it looks like I’ll have to go use the curl request reply method you mentioned as this work is due end of week.

    Just wanted to encourage you. I really appreciate what you’re doing. Ever need help, let me know :)

  8. Josh Pratt says:


    Thanks for the comment. That stuff is going to be complete fixed and not an issue with the release of 1.2 – which I hope will be released sometime next week. Thanks!

  9. George says:

    I read in your code:
    [code] * Note: I have found that only Milestones, File Attachments, and Time-Tracking posts
    * return an XML response. Messages, Comments, and To-Dos do not send back an XML response.
    * This makes it difficult because for those three resources that do NOT send back an XML
    * response, I have to pull the new data (new resource id) from the header instead, creating
    * two distinct methods. I have contacted 37 signals about this, and I’m still waiting for
    * a response. So, at this time, when posting Messages, Comments, or To-Dos, there is no
    * ID returned.
    Dunno if this helps you, but an idea:
    I got the headers from the curl request reply using Sean Huber’s Curl wrapper:
    and then preg_replace’ing the last chars of:

  10. Erin says:

    We are anxiously waiting.

  11. Josh Pratt says:


    Ahh – good catch on the category id’s. I will try and put together a function to gather that – as well as a generic function to manually set it as well. Thanks!


    They are coming! Hopefully sometime by Thursday night (Dec. 4th.)

  12. Whoops… XML tags got stripped out….

  13. Thanks Josh — Got it working once I removed the default category-id from post_message(). Anyone know how to query for one’s (unique) list of categories?

  14. jeff says:

    I have it working as well for posting messages. Just anxiously waiting for attachments!

  15. Josh Pratt says:


    The class should be functional – I and Erin have it working. I’ll write you an email.

  16. Hello everyone. I’m happy to see Josh working on this. I’m having mixed luck. Can’t seem to post messages. When anyone has a working chunk of code (assuming the class and basic declarations) that’d be great.

    @Erin — can you post what you did to get message posting to work?

  17. Josh Pratt says:


    Fantastic! Yes – I don’t have any methods for updating anything yet. I will include updating messages in the next release! Thanks for the feedback.

  18. Erin says:

    Hi again,

    I have your class working (yay!) for posting new messages, but I am struggling with updating an existing message. Will you include updates (rather than new posts) in your class?


  19. Josh Pratt says:


    I should post one soon. I’ve been waiting for 37 signals to get back to me on something. I’ve noticed that when posting messges, comments, to-do lists and items, I don’t get an XML response back – which complicates the code.

    Perhaps I can just figure out a work-around for now. I’ll plan on a release within a week hopefully. I think I’ll have some time to do it on Thursday. We’ll see.

  20. jeff says:

    I see on twitter you’ve got file attachments working! When do you think you will get around to posting an update?

  21. Josh Pratt says:


    Yes – Milestones are on the list for the next release.

    In regards to posting a message associated with the milestone, I can create the post_milestone method return the resource_id, or have that method store the resource_id into a variable which can be retrieved. Then, you can just call the post_message function and make sure you’ve given it the resource_id, thus it would then post your message to that milestone.

  22. Erin says:

    How about posting milestones? Better yet, how about posting a milestone, then a message and associating the milestone to the message?