2017 © Pedro Peláez
 

library wellrested

Simple PHP Library for RESTful APIs

image

wellrested/wellrested

Simple PHP Library for RESTful APIs

  • Thursday, June 28, 2018
  • by pjdietz
  • Repository
  • 6 Watchers
  • 46 Stars
  • 2,896 Installations
  • PHP
  • 3 Dependents
  • 1 Suggesters
  • 9 Forks
  • 0 Open issues
  • 38 Versions
  • 15 % Grown

The README.md

WellRESTed

Packagist PHP Version GitHub Workflow Status Read the Docs, (*1)

WellRESTed is a library for creating RESTful APIs and websites in PHP that provides abstraction for HTTP messages, a powerful handler and middleware system, and a flexible router., (*2)

Features

  • Router allows you to match paths with variables such as /foo/{bar}/{baz}.
  • Middleware system provides a way to compose your application from discrete, modular components.
  • Lazy-loaded handlers and middleware don't instantiate unless they're needed.

Supports PSR Standards

  • PSR-7 interfaces for requests, responses, and streams
  • PSR-15 interfaces for handlers and middleware
  • PSR-11 interfaces dependency injection

Install

Add an entry for "wellrested/wellrested" to your composer.json file's require property., (*3)

{
    "require": {
        "wellrested/wellrested": "^6"
    }
}

Documentation

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

Example

<?php

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use WellRESTed\Message\Response;
use WellRESTed\Message\Stream;
use WellRESTed\Server;

// Create a handler using the PSR-15 RequestHandlerInterface
class HomePageHandler implements RequestHandlerInterface
{
    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        // Create and return new Response object to return with status code,
        // headers, and body.
        $response = (new Response(200))
            ->withHeader('Content-type', 'text/html')
            ->withBody(new Stream('

Hello, world!

')); return $response; } } // ----------------------------------------------------------------------------- // Create a new Server instance. $server = new Server(); // Add a router to the server to map methods and endpoints to handlers. $router = $server->createRouter(); // Register the route GET / with an anonymous function that provides a handler. $router->register("GET", "/", function () { return new HomePageHandler(); }); // Add the router to the server. $server->add($router); // Read the request from the client, dispatch a handler, and output. $server->respond();

Development

Use Docker to run unit tests, manage Composer dependencies, and render a preview of the documentation site., (*5)

To get started, run:, (*6)

docker-compose build
docker-compose run --rm php composer install

To run PHPUnit tests, use the php service:, (*7)

docker-compose run --rm php phpunit

To run Psalm for static analysis:, (*8)

docker-compose run --rm php psalm

To run PHP Coding Standards Fixer:, (*9)

docker-compose run --rm php php-cs-fixer fix

To generate documentation, use the docs service:, (*10)

# Generate
docker-compose run --rm docs
# Clean
docker-compose run --rm docs make clean -C docs

To run a local playground site, use:, (*11)

docker-compose up -d

The runs a site you can access at http://localhost:8080. You can use this site to browser the documentation or code coverage report., (*12)

Copyright © 2024 by PJ Dietz Licensed under the MIT license, (*13)

The Versions

28/06 2018

dev-dev

dev-dev https://www.wellrested.org

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api psr-7 rest http psr7 restful

28/06 2018

v4.0.0-RC3

4.0.0.0-RC3 https://www.wellrested.org

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api psr-7 rest http psr7 restful

28/06 2018

v4.0.0-RC2

4.0.0.0-RC2 https://www.wellrested.org

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api psr-7 rest http psr7 restful

26/06 2018

v4.0.0-RC

4.0.0.0-RC https://www.wellrested.org

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api psr-7 rest http psr7 restful

13/03 2018

dev-master

9999999-dev https://www.wellrested.org

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api psr-7 rest http psr7 restful

13/03 2018

v3.1.0

3.1.0.0 https://www.wellrested.org

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api psr-7 rest http psr7 restful

13/03 2018

dev-psr15

dev-psr15 https://www.wellrested.org

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api psr-7 rest http psr7 restful

18/12 2017

v3.0.6

3.0.6.0 https://www.wellrested.org

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api psr-7 rest http psr7 restful

03/08 2017

v3.0.5

3.0.5.0 https://www.wellrested.org

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api psr-7 rest http psr7 restful

22/07 2017

v4.x-dev

4.9999999.9999999.9999999-dev https://www.wellrested.org

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api psr-7 rest http psr7 restful

22/05 2016

v3.0.4

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

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api rest http restful

21/05 2016

v3.0.3

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

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api rest http restful

22/02 2016

v3.0.2

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

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api rest http restful

09/11 2015

3.0.1

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

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api rest http restful

14/06 2015

v3.0.0

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

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api rest http restful

02/06 2015

v3.0.0-beta3

3.0.0.0-beta3 https://github.com/pjdietz/wellrested

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api rest http restful

25/05 2015

v3.0.0-beta2

3.0.0.0-beta2 https://github.com/pjdietz/wellrested

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api rest http restful

21/05 2015

v3.0.0-beta

3.0.0.0-beta https://github.com/pjdietz/wellrested

Simple PHP Library for RESTful APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by PJ Dietz

api curl rest http restful

17/03 2015

v2.3.0

2.3.0.0 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

12/03 2015

v2.3.0-alpha

2.3.0.0-alpha 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

02/02 2015

v2.2.1

2.2.1.0 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

21/01 2015

v2.2.0

2.2.0.0 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

01/01 2015

v2.1.0

2.1.0.0 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

02/08 2014

v2.0.3

2.0.3.0 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

28/07 2014

v2.0.2

2.0.2.0 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

28/07 2014

v2.0.1

2.0.1.0 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

27/07 2014

v2.0.0

2.0.0.0 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

07/04 2014

v1.4.1

1.4.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

19/03 2014

v1.4.0

1.4.0.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

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

17/08 2013

v1.3.0

1.3.0.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

14/08 2013

v1.2.2

1.2.2.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

13/06 2013

v1.2.1

1.2.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

27/05 2013

v1.2.0

1.2.0.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

19/05 2013

v1.1.2

1.1.2.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

29/03 2013

v1.1.1

1.1.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

27/03 2013

v1.1.0

1.1.0.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

02/02 2013

v1.0.0

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

Simple PHP Library for RESTful APIs

  Sources   Download

The Requires

  • php >=5.3.0

 

by PJ Dietz

api curl rest http restful