Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Micro-framework (like Flask, or Sinatra) for PHP [closed]

Tags:

I am working on a single-page Backbone-based app, that uses Facebook's API as a backend mechanism. Therefore, I need to write a very thin glue layer in between, using PHP. I have long-time experiences with CakePHP, CodeIgniter, Kohana, and all the other frameworks from the glorious days of MVC, and I am sure that if I take any of these, I would have to remove a lot of the complexity, rather than benefit from it.

What I am looking for should be a very thin layer on top of vanilla PHP, that gives you all the possibilities to extend, but does not push a bunch of configurations and conventions in your face.

In the Python world, there is a nice micro-framework,called Flask. I believe this is what Ruby's Sinatra also does. So how about a nice microframework in PHP?

like image 791
Preslav Rachev Avatar asked Sep 11 '12 06:09

Preslav Rachev


People also ask

Which is best Flask or PHP?

"Lightweight", "Python" and "Minimal" are the key factors why developers consider Flask; whereas "Large community", "Open source" and "Easy deployment" are the primary reasons why PHP is favored.

Is Flask a micro framework?

Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions.

Is FastAPI better than Flask?

When you're building APIs, FastAPI will be a better choice than Flask, especially when microservices are taken into consideration. The only argument for choosing Flask in this case would be if your organization already has a lot of tooling built around that framework.


1 Answers

Update 2018-05 because this answer still attracts quite some attention. Silex has been discontinued as of January.

There have been talks of getting new maintainers, but as I see it, nothing came of it.

Currently, Slim and Lumen seem like good alternatives, although Symfony v4 can be setup fairly small thanks to the new Flex system.


Silex is probably the one to go currently. It has the best support of modern PHP programming techniques, is developed in sync with its "big" brother Symfony2, unit-tested, well documented and provides possibility to introduce 3rd party libraries through a very good DI-container mechanism.

Personally, I use this framework for anything that does not need extensive caching, user-managing, heavy database interaction or security. So, basically 95% of the web apps I write.

like image 129
F.P Avatar answered Nov 18 '22 01:11

F.P