2017 © Pedro Peláez
 

library wellrested

Simple PHP Library for RESTful APIs

image

pjdietz/wellrested

Simple PHP Library for RESTful APIs

  • Tuesday, March 17, 2015
  • by pjdietz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 281 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

WellRESTed

Build Status, (*1)

WellRESTed is a micro-framework for creating RESTful APIs in PHP. It provides a lightweight yet powerful routing system and classes to make working with HTTP requests and responses clean and easy., (*2)

Requirements

  • PHP 5.3
  • PHP cURL for making requests with the Client class (Optional)

Install

Add an entry for "pjdietz/wellrested" to your composer.json file's require property. If you are not already using Composer, create a file in your project called "composer.json" with the following content:, (*3)

{
    "require": {
        "pjdietz/wellrested": "~2.3"
    }
}

Use Composer to download and install WellRESTed. Run these commands from the directory containing the composer.json file., (*4)

$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install

You can now use WellRESTed by including the vendor/autoload.php file generated by Composer., (*5)

Overview

WellRESTed's primary goal is to facilitate mapping of URIs to classes that will provide or accept representations. To do this, create a Router instance and load it up with some routes., (*6)

use pjdietz\WellRESTed\Response;
use pjdietz\WellRESTed\Router;

require_once "vendor/autoload.php";

// Create a new router.
$router = new Router();

// Populate the router with routes.
$router->add(
    ["/", "\\MyApi\\RootHandler"],
    ["/cats/", "\\MyApi\\CatHandler"],
    ["/dogs/*", "\\MyApi\\DogHandler"],
    ["/guinea-pigs/{id}", "\\MyApi\\GuineaPigHandler"],
    ["~/hamsters/([0-9]+)~", "\\MyApi\\HamsterHandler"]
);

// Output a response based on the request sent to the server.
$router->respond();

Documentation

See the documentation to get started., (*7)

Copyright © 2015 by PJ Dietz Licensed under the MIT license, (*8)

The Versions

17/03 2015

dev-master

9999999-dev https://github.com/pjdietz/wellrested

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by PJ Dietz

api curl rest http restful

26/08 2013

v1.3.1

1.3.1.0 https://github.com/pjdietz/wellrested

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by PJ Dietz

api curl rest http restful