PHPackages                             makusu/silex-skeleton-rest - 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. makusu/silex-skeleton-rest

ActiveLibrary[API Development](/categories/api)

makusu/silex-skeleton-rest
==========================

This skeleton / boilerplate is built using Silex for general ReSTful (API) purposes.

1.0.0(13y ago)161853MITPHP

Since Jan 8Pushed 12y ago4 watchersCompare

[ Source](https://github.com/makusu/silex-skeleton-rest)[ Packagist](https://packagist.org/packages/makusu/silex-skeleton-rest)[ Docs](http://github.com/makusu/silex-skeleton-rest)[ RSS](/packages/makusu-silex-skeleton-rest/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Silex Skeleton ReSTful
======================

[](#silex-skeleton-restful)

[![Build Status](https://camo.githubusercontent.com/6acabe3e676c9e84d520af290c3d686eb8f6c876d8dae9f68c85288b88febb5e/68747470733a2f2f7472617669732d63692e6f72672f6d616b7573752f73696c65782d736b656c65746f6e2d726573742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/makusu/silex-skeleton-rest)

Description
-----------

[](#description)

This skeleton (you can also call it boilerplate now) is built using [Silex](http://silex.sensiolabs.org/) for general [ReSTful (API)](http://en.wikipedia.org/wiki/Representational_state_transfer) purposes.

Background
----------

[](#background)

The very reason that this code exists is because I was having a hard time finding a good EXAMPLE on utilizing Silex for real life usage. I need a maintainable and testable code that made especially for API.

Of course there are many good slides and information out there, but most are just giving piece by piece explanation.

I'm not a good reader. I need an EXAMPLE!

FAQ
---

[](#faq)

"Dude, you can design silex however you want. That's the beauty of it."

- "Yes, I know. But I want a nice, solid framework out of it."

"Why don't you just use Symfony2 then?"

- "Too much" (Don't miss understand me. I like Symfony2, I use it for some of my projects. But let's be honest, it's just too bulky sometimes.)

"Is this code actually working?"

- "Yeap. I use it for some smaller projects of mine. In fact, I use this more than Symfony2 I can say."

"Enough chit-chat! Show me!"

- "Here!"

What you need to know
---------------------

[](#what-you-need-to-know)

- [PHP](http://php.net/)
- [Silex](http://silex.sensiolabs.org/)
- [Doctrine](http://www.doctrine-project.org/)
- [Composer](http://getcomposer.org/)
- [PHPUnit &amp; DBUnit](http://www.phpunit.de/) (Optional)

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

[](#installation)

You can do the conventional way which is clone this repository, or the easiest way, you can just directly download composer (if you don't have it yet) here:

```
http://getcomposer.org/download/

```

After the download is complete, you can start installing the required package by running this command:

```
$ php composer.phar create-project makusu/silex-skeleton-rest
```

You can add option "--dev" behind if you want to have the controller test working properly.

For this test, you need to put this sql command in MySQL.

```
CREATE DATABASE `tododb`;

CREATE DATABASE `todotestdb`;

CREATE TABLE `tododb`.`item` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `created` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `todotestdb`.`item` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `created` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into `tododb`.`item` values
(null, "Download silex-skeleton-rest.", "2013-01-01 00:00:00"),
(null, "Utilize the skeleton so I can use it for my project.", "2013-01-06 19:00:00");

insert into `todotestdb`.`item` values
(null, "Download silex-skeleton-rest.", "2013-01-01 00:00:00"),
(null, "Utilize the skeleton so I can use it for my project.", "2013-01-06 19:00:00");
```

Why do we need to have 2 same database? It's not compulsory. The idea is just to differentiate between our development and our test database environment.

Change the configurations to suit your environment. Don't worry, it's **simple**.

- app/config/dev.php
- app/config/prod.php
- app/config/test.php
- Copy app/phpunit.xml.dist into app/phpunit.xml, and take a look at the environment at the bottom of the file
- Your server configuration must be pointing to: web/index.php (prod) and web/index\_dev.php (dev)

If everything has been installed &amp; configured properly, try to put this url in your browser:

```
http://silex-skeleton-rest/item

```

You should see this result:

```
[
    {
        id: "1",
        name: "Download silex-skeleton-rest.",
        created: "2013-01-01 00:00:00"
    },
    {
        id: "2",
        name: "Utilize the skeleton so I can use it for my project.",
        created: "2013-01-06 19:00:00"
    }
]
```

Try also put this in your url:

```
http://silex-skeleton-rest/item/1
http://silex-skeleton-rest/item/2

```

If you can see a nice json result out of it, you can try to use http method POST, PUT and DELETE to manipulate the database using your api.

Finally, for testing purposes, you can just run this command at your main directory:

```
$ phpunit -c app/
```

Final
-----

[](#final)

Take your time and look around the code to understand more and do not hesitate to let me know if you have an idea how to improve this.

You're ready to go! Enjoy!

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4879d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/803474591bee8db20a75963f0a79868d33d820e3c738a9e58fa00b3b42b9f785?d=identicon)[makusu](/maintainers/makusu)

---

Top Contributors

[![makusu](https://avatars.githubusercontent.com/u/953584?v=4)](https://github.com/makusu "makusu (28 commits)")

### Embed Badge

![Health badge](/badges/makusu-silex-skeleton-rest/health.svg)

```
[![Health](https://phpackages.com/badges/makusu-silex-skeleton-rest/health.svg)](https://phpackages.com/packages/makusu-silex-skeleton-rest)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[flat3/lodata

OData v4.01 Producer for Laravel

96320.9k](/packages/flat3-lodata)

PHPackages © 2026

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