PHPackages                             napkinware/presto - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. napkinware/presto

AbandonedArchivedLibrary

napkinware/presto
=================

A simple RESTful API library for PHP.

1.0.0(13y ago)1183[16 issues](https://github.com/robotpony/presto/issues)[3 PRs](https://github.com/robotpony/presto/pulls)MITPHPPHP &gt;=5.3.15

Since Mar 12Pushed 10y ago3 watchersCompare

[ Source](https://github.com/robotpony/presto)[ Packagist](https://packagist.org/packages/napkinware/presto)[ RSS](/packages/napkinware-presto/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (6)Used By (0)

Presto 1.1
==========

[](#presto-11)

*Frugal PHP + REST toolkit*

Presto is a library for building RESTful APIs in PHP `5.3+`. It's lightweight, decoupled, and focused on making web apps the right way; using APIs and clean URLs to produce output in standard formats like JSON, HTML, and XML. It encourages separating views completely from your model and controller code, and to animate your user interfaces in HTML, CSS, and JavaScript. It also uses existing tools and libraries for what they're good at, like letting Apache deal with routing, and letting PHP load and execute a minimal amount of dynamic code.

How is Presto different?
------------------------

[](#how-is-presto-different)

Presto flattens standard MVC to fit REST requests better. It focuses on APIs built from simple classes, relying on the web server for routing and on PHP autoloading for delegating requests to class member calls. User interfaces are left to other toolkits, though Presto can serve up fragments of HTML with ease. Presto focuses on APIs.

### A quick example

[](#a-quick-example)

An API is a class with members named for each resource (or tree of resources). For example, an `apple` is a resource. You can request an `apple` over HTTP:

```
GET fruit/apples/spartan.json?tags=large+red

```

Presto maps the request to a file, class, and class member automatically. It loads the file, creates an instance of the class, and executes the member that best fits:

```
/* Loaded from 'fruit/apples.php' */

class apples extends API {

	public function get($params, $options, $body, $type) {

		if (count($params) === 0)
			throw new Exception('Missing required parameter', 400);

		/* Exceptions are returned as valid HTTP/content type
				responses */

		$thing = (object) array(
			'name' => $params[0],
			'tags' => $options['tags']
		);

		return $thing; // to client in requested format
	}
}

```

The `$thing` is automatically converted by Presto to the requested `Content-Type`, either implied by the request or the appropriate HTTP header. For formats not supported by default, *Output Adapters* can be defined and registered, or the type can be passed through for resources that are not based DOM style data.

Any HTTP request type is mapped automatically. For example, you can request a list of `apple` types available from the API:

```
LIST apples.json?colour=red

```

A LIST request is mapped to a function of the same name:

```
public function list(/* … */) { return array(); }

```

More complex resources are possible by either delegating (based on regex patterns), or by adding specific handlers. For example, you could add a `seeds` branch to the `apple` resource. Getting a list of seeds would map to:

```
public function list_seeds(/* … */) { array(); }

```

### What about errors?

[](#what-about-errors)

Errors are handled by the toolkit as standard PHP exceptions and standard PHP errors are remapped (where possible) to exceptions to ensure that logic and code errors are returned to clients as valid API returns. This means that individual APIs do not need to check return values, nor do they need to `try` and `catch` unless they need to do something special. Presto maps the standard exceptions to HTTP statuses and output in whatever format was requested where possible.

For example, if you encounter a parameter error you can simply throw an exception:

```
if (empty($param))
	throw new Exception('Missing required parameter', 400);

```

Presto translates the exception into a `400` with an appropriately encoded body.

The resulting API code is much more focused on carefully testing parameters, retrieving appropriate resources, and building rich DOMs instead of boilerplate code, managing responses, excessive error checking, routing, and other complex output generation.

Other interesting features
==========================

[](#other-interesting-features)

You can also:

- Add additional `content-types` by adding *output adapters* (`JSON`, simple `XML`, and simple `HTML` are built in)
- Add `content-type` filters to define what types of payloads a given resource supports.
- Add *custom delegation* for special resource types

**Note that PHP 5.3 or better is required, as Presto relies on anonymous functions and other newer PHP features. This makes it possible to write very clean, simple web services.**

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 67.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4815d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/32010a57e99da8aaf2e8d1c6fca3b857bf3d2c0ca2dbfbfb06946556f7496373?d=identicon)[robotpony](/maintainers/robotpony)

---

Top Contributors

[![robotpony](https://avatars.githubusercontent.com/u/163403?v=4)](https://github.com/robotpony "robotpony (261 commits)")[![adam-patterson](https://avatars.githubusercontent.com/u/1205321?v=4)](https://github.com/adam-patterson "adam-patterson (104 commits)")[![ngallagher87](https://avatars.githubusercontent.com/u/1816739?v=4)](https://github.com/ngallagher87 "ngallagher87 (21 commits)")[![jfh](https://avatars.githubusercontent.com/u/1210962?v=4)](https://github.com/jfh "jfh (1 commits)")

### Embed Badge

![Health badge](/badges/napkinware-presto/health.svg)

```
[![Health](https://phpackages.com/badges/napkinware-presto/health.svg)](https://phpackages.com/packages/napkinware-presto)
```

###  Alternatives

[edamov/pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key) or certificate-based authentication

4093.0M16](/packages/edamov-pushok)[pagseguro/pagseguro-php-sdk

Biblioteca de integração com o PagSeguro

312456.6k14](/packages/pagseguro-pagseguro-php-sdk)[michael/laravelpagseguro

Biblioteca de integração com o gateway de pagamento PagSeguro.

357149.3k1](/packages/michael-laravelpagseguro)[corsinvest/cv4pve-api-php

Corsinvest Proxmox VE Client API PHP

801.4M](/packages/corsinvest-cv4pve-api-php)[oxid-esales/paypal-module

This is the PayPal module for the OXID eShop.

36513.5k2](/packages/oxid-esales-paypal-module)[bestit/amazonpay4oxid

This is the Amazon Pay module for the OXID eShop.

11276.2k1](/packages/bestit-amazonpay4oxid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
