r/PHPhelp • u/Even_Gold2158 • Oct 31 '25
develope a Rest API
Hello, I want to develop a restapi, what framework would you recommend?
I'm searching myself, there are many options, but I'm worried about the security of the inputs.
If anyone has experience, I'd appreciate some advice.
Laravel is heavy, let's think about a simple api!
I want a simple and secure framework :(
8
Upvotes
9
u/BlueScreenJunky Oct 31 '25
Maybe a bit of an unpopular opinion : In most cases "The one you and your team already know", and "The one your use for your other projects". Laravel or Symfony may be overkill if your API is rather simple, but I'd much rather have all the projects of my team using the same framework than having "that one project using Laminas" that nobody wants to touch.
There are of course cases where you do need something else, like if you need to serve a huge number of requests with strong performance requirements, but if you can't achieve it with Laravel or Symfony with FrankenPHP or Swoole, then you'd probably need to reach for Go or Rust, not pick another PHP framework.
4
u/FreeLogicGate Oct 31 '25
I think you got a good number of options suggested. I would use Symfony.
You might also want to take a look at https://api-platform.com/ as a possible foundation element, that doesn't preclude using Laravel or Symfony as well. It has some interesting features and philosophy.
In my experience, people who haven't thoroughly thought through how they will design the REST api, tend to gloss over REST, and do a poor job in designing the API to be "restful". They are over focused on the "how" and don't spend enough time on the "what".
This is an old presentation, but one I highly recommend, as it digs into what REST is, how open to interpretation it can be, and what makes for RESTful vs non-restful API design.
Designing HTTP Interfaces and RESTful Web Services
3
u/lokidev Oct 31 '25
If you want magic with "hidden" background stuff: Laravel
There is also Slim (nice and simple, but never tried it)
I worked with Laminas Mezzio which is nice and less "easy", but also less magic than Laravel.
Symfony is also a good choice.
Now you have again multiple choices, my very rough recommendation:
- Laravel for easy entry and good documentation
- Symfony if you want more control
- Laminas/Mezzio if you want even more control (also uses some Symfony packages)
- Slim to try out as it seems perfect, but I don't have any experience with it
2
u/docwra2 Oct 31 '25 edited Oct 31 '25
You don't even need a framework really. Just write the data to an array and output using a single line. Just make sure you use Prepared statements when working with the data.
2
u/arhimedosin Oct 31 '25
try this : https://www.dotkernel.org/
It is based on mezzio and is simple enough
1
u/colshrapnel Oct 31 '25
Laravel is simple and secure framework. If you think otherwise, you need to improve your skill before developing a rest api
1
u/itemluminouswadison Oct 31 '25
Symfony can get pretty lightweight. Just go with something with high adoption
1
u/[deleted] Oct 31 '25
Framework-X by Clue
1
u/suncoast_customs Nov 01 '25
Slim is the go https://www.slimframework.com/
1
u/[deleted] Nov 01 '25
Might as well choose workerman
1
u/[deleted] Nov 02 '25 edited Jan 21 '26
enter doll reach kiss encourage scary employ like modern middle
This post was mass deleted and anonymized with Redact
1
u/LostJacket3 Nov 02 '25
ask chatgpt /s
1
u/Kluchol Nov 02 '25
Symfony
1
u/swiss__blade Nov 03 '25
I have been using Phalcon for the last 6 years and I love it. Learning curve can be a bit steep at times but nothing deal breaking.
Depending on your specific use case, you could also go with serverless functions...
1
u/Jealous-Bunch-6992 Nov 05 '25
I'm keen to give this ago when the need arises.
https://github.com/yiisoft/app-api
1
u/International-You466 Oct 31 '25
LUMEN also is a good option ... That is basically a api development friendly framework with capabilities of Laravel...
https://lumen.laravel.com/
1
u/CyberJack77 Oct 31 '25
For framework I cannot recommend anything else then Symfony. No matter the project.
Symfony is very small, flexible and strict, which makes it predicable. It works well with api-platform, but be sure to read about using DTOs instead of poisoning your entities with API logic.
I have build multiple APIs using Symfony and api-platform, and all are rock-solid and perform well.
0
u/Timely-Tale4769 Oct 31 '25
The codeigniter has been a light framework since 2006.