DEV Community


Discussion on: Choosing PHP in 2018

xowap profile image
Rémy 🤖

PHP has a lot of pain points. Printed errors vs exceptions. Someone forgets to use === and creates a security issue. The empty and inconsistent standard library. The lack of primitive types like sets. The fact that you have to implement modules loading yourself. I can still go on for a while...

Indeed, Laravel fights this and has gone a very long way. But why spend hours trying to figure which of your 200 files prints that space at the end of the JSON (that you didn't notice for the first hour) while you could just use a framework that is able to write your REST API at run-time using simply your data model and a tiny bit of configuration?

Thread Thread
jmolivas profile image
Jesus Manuel Olivas

Talking about building a REST-API and GraphQL application using PHP you can use the API Platform project (based on Symfony components). You can enable any model as REST/GraphQL endopint by simply adding an annotation to your model class.

This project includes 4 components:

  • API Component
    Build a fully-featured hypermedia or GraphQL API in minutes. Leverage its awesome features to develop complex and high performance API-first projects. Extend or override everything you want.

  • Schema Gen Component
    Instantly generates a PHP data model from the vocabulary. Let the ORM create the related tables.

  • Admin Component
    Adds a convenient Material Design administration interface built with React without writing a line of code. It's a Progressive Web App!

  • Client Gen Component
    Scaffolds a Progressive Web App (React or Vue.js) or a native mobile app (React Native), and edit it to fit your needs.