Download the PHP package kilylabs/phprest without Composer

On this page you can find all versions of the php package kilylabs/phprest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phprest

Kily Labs

Added PHP 7.0 support!

Phprest

Build Status Code Coverage Quality Score

Description

REST-like PHP micro-framework.

It's based on the Proton (StackPhp compatible) micro-framework.

Phprest gives you only the very basics to build your own architecture within your own framework and assemble any folder structure you like. It is just a thin layer around your application with the help of some great libraries.

Components

Skills

ToC

Installation

Install it through composer.

tip: you should browse the phprest/phprest page to choose a stable version to use, avoid the @stable meta constraint.

Usage

Services

There are a couple of services which can help you to solve some general problems:

These are separate repositories.

Setup

Configuration

You should check the Config class.

Logging

Usage with Stack

You can register middlewares trough the function.

API Versioning

Phprest works with API versions by default. This means that the ApiVersion Middleware manipulates the incoming request. The version (based on the current Accept header) is added to the path.

What does it mean?

Accept header Route Result route*
application/vnd.phprest-v1+json /temperatures /1.0/temperatures
application/vnd.phprest-v3.5+json /temperatures /3.5/temperatures
*/* /temperatures /the version which you set in your Config/temperatures

* It is not a redirect or a forward method, it is just an inner application routing through a middleware.


Accept/Content-Type header can be Transfers to
application/vnd.Vendor-vVersion+json itself
application/vnd.Vendor+json; version=Version itself
application/vnd.Vendor-vVersion+xml itself
application/vnd.Vendor+xml; version=Version itself
application/json application/vnd.Vendor-vVersion+json
application/xml application/vnd.Vendor-vVersion+xml
*/* application/vnd.Vendor-vVersion+json

API Version only can be one of the following ranges:


Routing

For more information please visit League/Route.

Simple routing

Routing with arguments

Routing through a controller

Routing through a service controller

Routing with annotations

You have to register your controller.

Controller

To create a Phprest Controller simply extends your class from .

Serialization, Deserialization, Hateoas

Except*:

Serialization example

Let's see a Temperature entity:

You do not have to use annotations! You can use configuration files! Browse in Jms\Serializer and Willdurand\Hateoas

The router:

Json response (Accept: application/vnd.vendor+json; version=1):

Xml response (Accept: application/vnd.vendor+xml; version=1):

Properties will be translated from camel-case to a lower-cased underscored name, e.g. camelCase -> camel_case by default. If you want to use a custom serialized name you have to use the @SerializedName option on your attribute.

Deserialization example

You have to use the HATEOAS Util trait in your controller to do deserialization.

Pagination

For more informations please visit the HATEOAS docs

Responses

There are several responses you can use by default, one of them is the Ok response.

1xx, 2xx, 3xx status codes

These are simple Response objects.

Example

Types

Responses
Accepted
Created
NoContent
NotModified
Ok

4xx, 5xx status codes

These are Exceptions.

Example

Types

Exceptions
BadRequest
Conflict
Forbidden
Gone
InternalServerError
MethodNotAllowed
NotAcceptable
NotFound
TooManyRequests
PreconditionFailed
TooManyRequests
Unauthorized
UnprocessableEntity
UnsupportedMediaType

Dependency Injection Container

See Proton's doc and for more information please visit League/Container.

CLI

You can use a helper script if you want after a composer install ().

You have to provide the (bootstrapped) app instance for the script. You have two options for this:

Error handler

Phprest handles error with League\BooBoo. The default formatter is Json and Xml Formatter.

On a single exception

The response is content negotiationed (xml/json), the status code is 503.

Authentication

Basic Authentication

You'll need this package:

JWT Authentication

You'll need this package:

API testing

There are a couple of great tools out there for testing your API.

API documentation

Just a few recommendations:


All versions of phprest with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
league/booboo Version ^1.1
league/container Version ^1.3
league/event Version ^2.2
league/route Version ^1.2
monolog/monolog Version ^1.12
stack/builder Version ^1.0
symfony/http-kernel Version ^3.2
willdurand/hateoas Version ^2.3
willdurand/negotiation Version ^1.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kilylabs/phprest contains the following files

Loading the files please wait ....