Swizec Teller - a geek with a hatswizec.com

    Symfony and the scary world of PHP

    PHP Rockstars
    PHP Rockstars

    One of my clients demanded I do a recent project in PHP.

    Alarm bells all 'round, but hey, I used to do a lot of things in PHP before I got fed up with the inconsistent API and I hear many people still use it. It's clearly a viable technology for ... things. Sure thing mr. Client, I'll do this in PHP for you.

    What could possibly go wrong?

    Everything, obviously.

    Modern PHP world

    Symfony Live Paris 2011
    Symfony Live Paris 2011

    There's no such thing. The PHP world is stuck in arcane ways of cobbled together solutions, Not Invented Here syndrome, everyone and their grandma inventing their own CMS-like thing and general weirdness.

    And yet, I looked far and wide for a framework similar enough to Django that I could quickly pick up and make something useful without sacrificing my soul to the god of bad engineering practices.

    Symfony is an Open Source distributed PHP framework. Of course, when you know how to develop in PHP, you don't need a framework. However, it is very nice to have one!

    Get it?

    Read it again.

    It's horrible because PHP developers are people who still need to be convinced that letting somebody else worry about the boring stuff is better. Of course they can make everything themselves! Are you questioning their manhood by suggesting a framework?

    Undeterred, I decided to make my _"Accept some data from the browser. Calculate three things. Send an email" _in Symfony. Using Django this would take one afternoon.


    I appreciate everything Symfony is trying to do, but Django it is not.


    The base architecture is confusing - everything, even the framework, is a plugin of the framework ... what? - the documentation isn't very good and there's no community to speak of.

    I'm told this is the most popular PHP framework out there.

    Coming upon problems and Googling for answers will leave you pawing your way through a dark corridor, with one eye poked out and half your leg missing. The freshest StackOverflow activity about Symfony is at least six months old. There are no forum posts to be found, almost zero blogposts ...

    The internet is screaming DON'T USE THIS at you.

    And yet, it's the best way to avoid writing your own form validations, request handling, testing frameworks, object relational mapping and a bunch of other things you've come to take for granted.

    However, the greatest offense is from the official documentation. I'm not sure if this is because the authors are trying so hard to sell their Cookbook, or just because they suck at writing docs.

    For starters, everything is padded out with a bunch of marketing bullshit and irrelevant hand holding. I know why I'm looking at this damn it! Stop trying to convince me I'm really really going to love the feature you are about to explain; explain the fucking feature!


    To make it worse, everything lacks depth. Want to see a list of possible methods? Perhaps all the possible parameters and what they do? Nope.

    You can click your way through twenty levels of ... stuff ... and you'll get a short summary_ _of all the parameters and methods and such. A tiny piece of me died every time I went digging through the source code just to discover everything that's possible.

    Symfony guys, I understand you're trying to be helpful, but developers are smart humans - even PHP developers - we can figure out how to do something with the basic building blocks, but you really need to tell us what the building blocks are.


    All in all, PHP is still a horrible place to be. Symfony makes it a dash more palatable, it's far from perfect, far from really really useful, but the best I could find.

    My heart goes to all the programmers stuck in this madness, stay strong!

    PS: for anyone wondering, I was/am using Symfony 2.1

    Enhanced by Zemanta

    Did you enjoy this article?

    Published on October 26th, 2012 in Application programming interface, django, Frameworks, Object-relational mapping, Open source, PHP, Symfony, Uncategorized

    Learned something new?
    Want to become an expert?

    Here's how it works 👇

    Leave your email and I'll send you thoughtfully written emails every week about React, JavaScript, and your career. Lessons learned over 20 years in the industry working with companies ranging from tiny startups to Fortune5 behemoths.

    Join Swizec's Newsletter

    And get thoughtful letters 💌 on mindsets, tactics, and technical skills for your career. Real lessons from building production software. No bullshit.

    "Man, love your simple writing! Yours is the only newsletter I open and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. 👌"

    ~ Ashish Kumar

    Join over 14,000 engineers just like you already improving their careers with my letters, workshops, courses, and talks. ✌️

    Have a burning question that you think I can answer? I don't have all of the answers, but I have some! Hit me up on twitter or book a 30min ama for in-depth help.

    Ready to Stop copy pasting D3 examples and create data visualizations of your own?  Learn how to build scalable dataviz components your whole team can understand with React for Data Visualization

    Curious about Serverless and the modern backend? Check out Serverless Handbook, modern backend for the frontend engineer.

    Ready to learn how it all fits together and build a modern webapp from scratch? Learn how to launch a webapp and make your first 💰 on the side with ServerlessReact.Dev

    Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com

    By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️

    Created by Swizec with ❤️