andrewtweber/proste-sdk

Proste SDK - easy SDK for any RESTful API.

Installs: 352

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

Type:project

pkg:composer/andrewtweber/proste-sdk

dev-master 2025-04-14 16:47 UTC

This package is not auto-updated.

Last update: 2025-12-08 13:23:49 UTC


README

CircleCI

Easy SDK for any RESTful API

To install simply run

$ composer require andrewtweber/proste-sdk

Extending

Proste is an abstract class. In most cases you simply need to extend it, give it a name, and specify the base URL

class GitHub extends SDK
{
    public string $name = 'GitHub';
 
    public string $base_url = 'https://api.github.com/';
}

Usage

All requests will throw an Exception if the HTTP status code returned is not 2**

The responses returned are expected to be JSON and are decoded into an array.

$github = new \Proste\GitHub();

try {
    $releases = $github->get('repos/andrewtweber/proste-sdk/releases');

    dd($releases);

    $github->post('repos/andrewtweber/proste-sdk/issues', [
        'title' => 'New Issue',
        'body' => 'Your project is terrible',
    ]);
} catch (\Proste\Exceptions\HttpException $e) {
}

Todo

  • Make options available on all requests
  • Basic authorization trait
  • Tests