Skip to content

Releases: Zetaphor/reddit-api-client

Composer License Update

04 Dec 16:15
Compare
Choose a tag to compare

Composer was still reporting GPL, license is now MIT

Numerous Updates

02 Dec 22:40
Compare
Choose a tag to compare

New Commands

  • GetAccountSubmittedContributions
  • GetInboxMessages
  • GetUnreadMessages
  • GetMentions
  • SendMessage
  • ReadMessage
  • ReadAllMessages
  • Delete
  • SubmitComment

Other Changes

  • Modhash returned in headers
  • Changed to MIT License
  • Dev Composer requirements moved to require-dev (Mockery, PHPUnit, PHP Codesniffer)
  • Composer binary removed from repository

Guzzle Adoption

29 Nov 08:13
Compare
Choose a tag to compare

This is a big, BC-breaking release. Please don't upgrade to this version without doing your homework first, as any dependent code will be badly broken.

The central theme to this release is the adoption of the Guzzle HTTP client framework. The old custom HttpRequest and HttpResponse classes are gone, replaced with Guzzle's extremely mature cURL integration. And instead of custom-written methods for each supported API service, the service is described in JSON.

This is what using this client looks like now:

<?php
require 'vendor/autoload.php';

$clientFactory = new Reddit\Api\Client\Factory;
$client = $clientFactory->createClient();

$login = $client->getCommand(
    'Login',
    array(
        'api_type' => 'json',
        'user'     => 'Example_User',
        'passwd'   => 'password123',
    )
);
$login->execute();

$submit = $client->getCommand(
    'Submit',
    array(
        'sr'    => 'programming',
        'kind'  => 'link',
        'title' => 'Mongo DB Is Web Scale',
        'url'   => 'http://www.youtube.com/watch?v=b2F-DItXtZs',
    )
);
$submit->execute();

This approach to API client development is, in my opinion at least, the current state-of-the-art in PHP. The changes brought by this release, although potentially inconvenient, should stand the project in good stead for several years to come.