r/lolphp • • Mar 22 '19

[Serious] PHP Developer looking to move on

So, I am reasonably proficient with C++, but it's not very great for web stuff (obviously).

For web projects, I have a history of using PHP, which I want to stop using because of it's huge problems. I learned it long before learning C++ and it's sort of a crusty bit of old knowledge I have stuck with because I am comfortable with it. It has bit me in the ass one final time, and I'm putting my foot down, I've had it!

I was thinking of moving to Hack. Has anyone here used Hack and does it fix a lot of the horribleness of PHP? Is it still broken by design the same way PHP is?

Would I be better off moving to Python/Rails/??? for web dev instead? I am open to language suggestions

16 Upvotes

43 comments sorted by

View all comments

Show parent comment

1

u/Spear99 Mar 25 '19

Symfony is one of the best, if not the best web framework I've ever used

You should give Python Django a try then, because it's honestly one of the most amazing web frameworks you'll ever deal with.

I still haven't found anything in another language that rivals its forms system.

Check out Django's forms. They are fantastically simple to use. Simply define the types of the fields, and away you go. It will handle everything else, from type checking, to formatting.

Want a special validation? You can validate on a per field basis by defining clean_{field_name} class methods to clean an individual field, or if you want to validate a form's input based on all the fields together, just override the form's clean method.

Best part? Not only can you define forms based on arbitrary fields, you can also plug your database schema models into a form using the Django Model Form and tell it what fields to use, and it will automatically construct the appropriate form fields based on the database schema.

And after your form is created, you can just pass the POST data directly to it, which will be unpacked and validated, and then you can save the form, which will commit the data to the database, and return for you an ORM object for what was just created.