PHPackages                             steos/restmachine - 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. steos/restmachine

ActiveLibrary

steos/restmachine
=================

webmachine for PHP

026[1 PRs](https://github.com/steos/restmachine/pulls)PHP

Since Jul 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/steos/restmachine)[ Packagist](https://packagist.org/packages/steos/restmachine)[ RSS](/packages/steos-restmachine/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

restmachine
===========

[](#restmachine)

[![Build Status](https://camo.githubusercontent.com/f0dd17a3067b97d7b5242fccaae1bf0169833eb4c6701c5ecdc14017fb4b555d/68747470733a2f2f7472617669732d63692e6f72672f7374656f732f726573746d616368696e652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/steos/restmachine)

restmachine is a [webmachine](https://github.com/webmachine/webmachine) implementation for PHP.

Webmachine brings HTTP semantic awareness to your application. It allows you to declaratively specify dynamic HTTP resources so you don't have to worry about implementation details.

Example
-------

[](#example)

```
Resource::create(self::defaults())
    ->allowedMethods(['GET', 'PUT', 'DELETE'])
    ->isProcessable(self::validator())
    ->canPutToMissing(false)
    ->isNew(false)
    ->isRespondWithEntity(function(Context $context) {
        return $context->getRequest()->isMethod('PUT');
    })
    ->exists(function($context) use ($db, $id) {
        return Todo::exists($db, $id);
    })
    ->put(function($context) use ($db, $id) {
        Todo::update($db, $id, $context->entity);
    })
    ->delete(function($context) use ($db, $id) {
        Todo::delete($db, $id);
    })
    ->handleOk(function(Context $context) use ($db, $id) {
        return Todo::fetchOne($db, $id);
    });
```

### Install

[](#install)

With composer:

```
{
  "require": {
    "steos/restmachine": "dev-master"
  }
}

```

restmachine currently requires PHP &gt;= 7.4.

Documentation
-------------

[](#documentation)

- [Getting Started](doc/getting-started.md)
- [How It Works](doc/how-it-works.md)
- [Serialization](doc/serialization.md)
- [Content Negotiation](doc/content-negotiation.md)
- [Conditional Requests](doc/conditional-requests.md)
- [Debugging](doc/debugging.md)

Credits
-------

[](#credits)

Credits go to

- [clojure-liberator](http://clojure-liberator.github.io/liberator/)where we extracted the decision graph and which we heavily used as reference and documentation to understand the webmachine execution model
- [Symfony HttpFoundation](https://github.com/symfony/HttpFoundation)which RestMachine is built on.

Project Status
--------------

[](#project-status)

This is beta software. Some functionality is still missing. There will be bugs. The API may still change, but should be fairly stable.

### TODO

[](#todo)

- Content negotiation for language, charset, encoding
- Standalone wrapper with routing
- PATCH method
- handle RFC850/1036 and ANSI C's asctime() format as per rfc 2616 (`Utils::parseHttpDate`)

License
-------

[](#license)

Copyright © 2020 Stefan Oestreicher and contributors.

Distributed under the terms of the BSD-3-Clause license.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/622a783d18305bb95f9788d068fc2bfb3be0859b0c12eb9da81d9baeb3079a07?d=identicon)[steos](/maintainers/steos)

---

Top Contributors

[![steos](https://avatars.githubusercontent.com/u/481021?v=4)](https://github.com/steos "steos (71 commits)")

### Embed Badge

![Health badge](/badges/steos-restmachine/health.svg)

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

PHPackages © 2026

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