7

I have to create a REST API for a mobile application and I don't really know how to begin it. I read some articles and tutorial about REST in general, but I didn't find a complexe API example written in PHP.

So after more researches I choose to use a micro-framework (rather than start from scratch). A full framework like Symfony2 or Zend provide some methods that I will not need, and I think they are too big for. Because I already worked with Silex PHP, I choose it.

But one question stay in my mind : is Silex a good choice to create a (future) big API ?

The API will evolve and could be more and more complexe (understand more URI will be avalaible in future, because we have goal to migrate from SOAP to REST).

Since Silex PHP uses a single file convention, I'm a little scared to use it (because file will be more and more larger, and I supposed with performances falling). Also I would like to cache on server results (additionally with HTTP caching) when necessary, to reduce queries to database (MySQL).

What do you think and what do you advise ? :)

4

2 回答 2

1

Silex is not a bad choice for building out an api service. I would recommend maybe starting with Silex Kitchen Edition for some decent organization and other useful configs and strip out what you don't need. Also, I would look for existing restful projects written in silex/symfony. As far as scalability you should read this post from Igor Wiedler one of the creators of silex.

于 2014-12-17T15:39:00.710 回答
-9

Silex is a microframework meant to be used in small projects. It's suitable for small websites with low traffic. It is also a good way to introduce yourself into some concepts like dependency injection, without introducing too many abstraction layers. They've recently introduced the target in their website as "single-file apps", giving you a bit of the target scope for the framework.

I think it should be fairly accepted fact that Silex is not suitable for anything big. Silex will not perform badly if your project works, but it will not be the nicest to work with once you start growing, as it will not help you too much. Symfony uses concepts you'll see in Silex and is a full stack framework you can use for bigger applications with lots of bundles, plugins and a big community there to help you.

Edit:

Note I cannot delete the answer as it has been accepted. I haven't used PHP in years now, since then, Silex has changed their approach from "microframework" to being just a library it seems. Whatever the case, the down-voting I believe must come from people involved with the project, probably upset of having created something which didn't take off as they may have hoped.

Just read the product docs, this was a request for an opinion which was given and accepted. I don't think this question belongs to stackoverflow anyway.

于 2012-10-12T16:29:59.710 回答