PHPackages                             mcuadros/silex-hateoas - 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. [API Development](/categories/api)
4. /
5. mcuadros/silex-hateoas

AbandonedArchivedLibrary[API Development](/categories/api)

mcuadros/silex-hateoas
======================

81611PHP

Since Jun 12Pushed 12y ago3 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (1)

Silex RESTful HATEOAS Service
=============================

[](#silex-restful-hateoas-service)

This is a little example of how build a RESTful HATEOAS Service on Silex.

Requirements
------------

[](#requirements)

- PHP 5.3.x;
- silex/silex
- nocarrier/hal
- shrikeh/teapot
- popshack/silex-hal-serviceprovider

Installation
------------

[](#installation)

The recommended way of installing this example is [through composer](http://getcomposer.org). You can see [package information on Packagist.](https://packagist.org/packages/mcuadros/silex-hateoas)

```
git clone https://github.com/mcuadros/silex-hateoas silex-hateoas
cd silex-hateoas
git checkout basic
composer install
```

Examples
--------

[](#examples)

You can run the example project with the built-in PHP server with:

```
php -S 0.0.0.0:8080 index.php
```

### Retrieving all the resources

[](#retrieving-all-the-resources)

```
curl http://localhost:8080/articles -X GET -i
```

```
HTTP/1.1 200 OK
Host: localhost:8080
Connection: close
X-Powered-By: PHP/5.4.12
Cache-Control: no-cache
Date: Wed, 12 Jun 2013 13:57:22 GMT
Content-Type: application/hal+json

{
  "_links": {
    "self": {
      "href": "\/articles"
    },
    "search": {
      "href": "\/articles\/{order_id}"
    }
  },
  "_embedded": {
    "article": [
      {
        "id": 1,
        "title": "foo",
        "author": "bar",
        "votes": 121,
        "_links": {
          "self": {
            "href": "\/articles\/1"
          }
        }
      },
      {
        "id": 2,
        "title": "qux",
        "author": "baz",
        "votes": 423,
        "_links": {
          "self": {
            "href": "\/articles\/2"
          }
        }
      },
      {
        "id": 3,
        "title": "bar",
        "author": "qux",
        "votes": 23,
        "_links": {
          "self": {
            "href": "\/articles\/3"
          }
        }
      }
    ]
  }
}
```

### Retrieving one resource

[](#retrieving-one-resource)

```
curl http://localhost:8080/articles/1 -X GET -i
```

```
HTTP/1.1 200 OK
Host: localhost:8080
Connection: close
X-Powered-By: PHP/5.4.12
Cache-Control: no-cache
Date: Wed, 12 Jun 2013 14:14:05 GMT
Content-Type: application/hal+json

{
  "id": 1,
  "title": "foo",
  "author": "bar",
  "votes": 121,
  "_links": {
    "self": {
      "href": "\/articles\/1"
    }
  }
}
```

### Creating a resource

[](#creating-a-resource)

```
curl http://localhost:8080/articles -X PUT -i -d "title=HATEOAS%20Restful%20Demo&author=Mximo%20Cuadros"
```

```
HTTP/1.1 201 Created
Host: localhost:8080
Connection: close
X-Powered-By: PHP/5.4.12
Cache-Control: no-cache
Date: Wed, 12 Jun 2013 14:00:08 GMT
Content-Type: application/hal+json

{
  "title": "HATEOAS Restful Demo",
  "author": "Mximo Cuadros",
  "_links": {
    "self": {
      "href": "\/articles\/4"
    }
  }
}
```

### Modifying a resource

[](#modifying-a-resource)

```
curl http://localhost:8080/articles/1 -X POST -i -d "author=Maximo%20Cuadros"
```

```
HTTP/1.1 201 Created
Host: localhost:8080
Connection: close
X-Powered-By: PHP/5.4.12
Cache-Control: no-cache
Date: Wed, 12 Jun 2013 14:00:08 GMT
Content-Type: application/hal+json

{
  "id": 1,
  "title": "foo",
  "author": "Maximo Cuadros",
  "votes": 121,
  "_links": {
    "self": {
      "href": "\/articles\/1"
    }
  }
}
```

### Delete a resource

[](#delete-a-resource)

```
curl http://localhost:8080/articles/1 -X DELETE -i"
```

```
HTTP/1.1 200 OK
Host: localhost:8080
Connection: close
X-Powered-By: PHP/5.4.12
Cache-Control: no-cache
Date: Wed, 12 Jun 2013 14:04:53 GMT
Content-Type: application/hal+json
```

License
-------

[](#license)

MIT, see [LICENSE](LICENSE)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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://avatars.githubusercontent.com/u/1573114?v=4)[Máximo Cuadros](/maintainers/mcuadros)[@mcuadros](https://github.com/mcuadros)

---

Top Contributors

[![mcuadros](https://avatars.githubusercontent.com/u/1573114?v=4)](https://github.com/mcuadros "mcuadros (9 commits)")

### Embed Badge

![Health badge](/badges/mcuadros-silex-hateoas/health.svg)

```
[![Health](https://phpackages.com/badges/mcuadros-silex-hateoas/health.svg)](https://phpackages.com/packages/mcuadros-silex-hateoas)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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