PHPSummerCamp Review

Bruno Skvorc
Share

The PHPSummerCamp of 2014 is over. Three days of hands-on workshops with experts from their fields provided us all with new insights, perspectives and tricks. While I wish I could have participated in all the workshops, that was simply not an option. Hence, I’ll talk about the ones I did join.

Appliance

Before the conference, we were given a Virtualbox appliance. For the uninitiated, an appliance is a pre-configured virtual box, something like a base box when using Vagrant, with pre-installed pre-configured software inside it. In theory, just booting it up should let you have the same environment as everyone else. In practice, this is rarely so – a huge chunk of the first workshop’s time was eaten away by configuration problems and folder sharing issues.

While it was disappointing that Vagrant wasn’t used to set up a unified development environment for everyone, the appliance actually worked amazingly well. Setting up a samba share AND maintaining a symlink consistency was less than a couple of minutes of work on my Windows machine, and while I can only imagine the hell they went through while setting it up, I wholly appreciate the ease of use it created for us, the audience. Well done to all, both speakers and organizers!

Day 1

Symfony Basics

On day one, I joined a Symfony basics workshop by Ryan Weaver. An absolutely excellent veteran speaker from KNP Labs, Ryan conquered the room with his enthusiasm, energy and positive reinforcement constantly thrown at all audience members with enough audacity to ask a question.

This workshop introduced Symfony in a very friendly manner, presenting it as much simpler than I actually believe it to be with all the bundle, kernel, app vs app_dev chaos and the half dozen config files.

It was a bit confusing to see a new recommended practice emerge which advises the moving of templates into the Resources of the app folder instead of having them in a bundle, but when dealing with the main application’s bundle, it’s questionable whether it’s even good practice to have a bundle at all. One must be main, no matter how the app is configured in the end. I’ve discussed this bundle breaking at length with Ryan, and he’s had some interesting things to say about it – we’ll deal with this in depth in a future post. One thing that does rub me the wrong way here is having to alter two core files just to install a bundle – one to tell the main routing file to read the bundle’s routes from the bundle, and another to activate the bundle in the AppKernel file. Sometimes, you even need to tweak additional config files. This seems like too much editing over too many files just to make a bundle work. Seeing as Symfony console commands (see day 3) are automatically registered, adopting a similar approach to auto-loading routes and auto-activating a bundle by reading its own files (thus keeping everything encapsulated) makes sense to me – though perhaps I’m seeing things with a too simplistic eye and this warrants more discussion.

What got my hopes up was seeing Symfony steer away from highly specific and somewhat cryptic syntax. For example, in Twig templates, {% extends '::base.html.twig' %} can now be written as {% extends 'base.html.twig' %}, thus no longer needing the ::. This is beneficial to the community at large, less confusion all around. Ryan said Symfony is trying to remove the cryptics from other places too (having the @ symbol on arguments for services in the DI, for example, is somewhat confusing and could use a better syntax – @ is not something people associate with good practice), which will only help in new user adoption.

All in all, this talk was an excellent starter of the whole camp, and so much more than simple “basics” tutorials you can find online.

Building a REST API with Symfony 2

This talk by Antonio Peric was rather underwhelming. An application was presented, though how exactly it differed from this one was not made clear, and there wasn’t nearly as much coding as expected or promised.

The underlying philosophy was interesting, and the code seemed compelling, albeit slightly too complex for something as simple as a REST app, but this was not followed by good explanations and the whole thing felt rushed, further complicated by a wrong repo included in the provided virtual appliance. Granted, the original timeframe seemed rather short anyway, so considering how much was done, it was done well.

The general impression I got from the talk was that a REST app was simple to build with Symfony with the addition of 4-5 bundles, but those bundles seemed far too large and complex for something like this.

Creating a Basic CMS with the CMF and the RoutingAutoBundle

Daniel Leech, who impressively cycled for hundreds of miles to get to the conference, and Willem-Jan Zijderveld presented the creation of a basic CMS with Symfony’s CMF and the RoutingAutoBundle.

The workshop consisted of following them through a set of steps to get from a base project to a fully functioning one, though given the short timeframe they were allowed, it felt slightly rushed. Luckily, they prepared well and had the repo branched into these steps, so someone who didn’t manage to keep up could catch up easily by simply checking out another branch.

As a non-user of Symfony, the general impression I got from this workshop was, again, that it was vastly overcomplicated for something as simple as a CMS, especially one that is basic (so no detailed user roles, no CDN, no Markdown…). We downloaded many bundles, edited many files, and ended up with a simple form that saves content in a blog-titled shape into the database. For that much code and manual labor, one could use something as bad as WordPress and end up with less bloat – it seemed like we wrote too much code for too little upgradeability and maintainability in the long run. The most impressive part of the app was the RoutingAutoBundle which, as its name suggests, automatically determines routes of the content of the CMS and produces output according to that, unless no adequate output is found when it falls back on the default Symfony router.

While this routing technique was far from science fiction (even WordPress uses it), it was interesting to learn it exists in a bundle and can easily be tacked onto the default routing queue in Symfony. One gripe I do have with this workshop, though, is that it seemed like little more than direct reading from the CMF tutorial. It also used PHPCR extensively, which, in my opinion, wasn’t explained enough, along with terms like CMF, JCR, Content Store, and other meta terms that I believe should have been prerequisite theory.

Day 2

Behat Basics

Another workshop by Ryan Weaver – an introduction to the magical world of feature testing with Behat. We ran through a practical example and built up to a decent project. The first example was neatly decoupled from the rest, introducing us to the terminology of features, and to step by step testing until a pass is shown. Next, we implemented BDD on a web app with Mink, which opened our eyes to the beauty of browser automation. Needless to say, Behat immediately became a tool in my arsenal – I had been aware of it before, but never so concretely.

Ryan was his usual self – energetic and positive, and included readable and simple, down to earth slides – all of which were also in the project we were given via the Virtual Machine appliance so we could rewind at will, catch up, do the extra credit tasks, and more. Some magic was demonstrated, too, like taking a screenshot of the web app when a test fails (see here) or waiting for JS popups to render before testing for their existence. Finally, as a true “from scratch with Behat” project, we were introduced to Sylius. If you’re in any way interested in what an application that’s built from the ground up with Behavioral testing in mind looks like, check it out. The features included are staggering.

PHPSpec Basics

After Ryan, Saša took the stage. Also from KNP, Saša’s first ever talk was better than expected for a rookie, and he covered PHPSpec well. His workshop introduced the audience to the mystical world of auto-mocking and code generation with PHPSpec – a specification testing tool that can either be used as a replacement for, or complement to PHPUnit. An optimal setup seems to be a combination of Behat and PHPSpec, leaving PHPUnit as optional.

His slides were less independent (i.e. you couldn’t go through them without guidance), and we ran out of time in the end, which was unfortunate, but all in all this workshop introduced an otherwise highly esoteric concept in a very approachable manner and converted many an audience member to the ease of testing with PHPSpec. If you’re interested, here’s a pretty good cheatsheet, too.

Day 3

MongoDB with PHP

Held by Derick Rethans, the maker of Xdebug, maintainer of the MongoDB driver for PHP and fellow Doctor Who fan, this workshop dove deep into the intricacies of using MongoDB with PHP, chaining queries, approaching common problems with filtering results, and more. We built sample scripts, faked import procedures, and ordered and grouped beer types by rating and preference of the author (Derick has tried a whopping 999 beers by the end of his Croatian trip! – I was personally responsible for at least a couple).

Initially, we ran out of time for the advanced part, but we continued later with a slightly smaller audience. In part two, we went deep into piping and aggregation, and even tried to set up replication (it’s really simple!) but ultimately failed, due to all of us being hosted each on a virtual machine. We learned about arbiters, primary election, replication procedures, the oplog which turns all database entry history into sets, even if the original queries were calculation, and much, much more.

It’s not every day you meet a guy who’s so responsible for changing the landscape of PHP he’s being taken for granted, so I hope to have Derick’s ear on several other occurrences yet to come.

Symfony Extra

Finally, we had an additional Symfony playground held, again, by Ryan. This part focused on the console – we toyed around with progress bars, console loops, colors, bundle installations via Composer and more. While not very advanced, the workshop was fun and interesting, and reminded me of my ancient Autofight project. Playing with the PHP CLI is always fun, and Autofight is due for a revival. Stay tuned, something fresh might be appearing on the PHP channel soon :)

Conclusion

PHPSummerCamp was a treasure trove of new knowledge. Not even taking into account the amazing hospitality of the speakers even though they had every right to stone me on the spot, or the fantastic leisure activities Netgen had planned for the event (from fancy fish dinners to boat rides, StarWars geek-out debates and Mexican cantina raffles), the entire conference was one of the better ones I’ve been to, if not the best.

I’ve met interesting people, talked to some of the folk in charge of eZ Publish about their roadmap and maintained contact afterwards to help out with developer experience matters to some degree, and, hopefully, gotten some people interested in checking our channel out – we’re all trying to forward the influence of PHP, and by helping each other we can do amazing things.

On the technical side, the realization was out of this world – not only was there a pro camera in each room for each talk, following the speaker with a dedicated cameraman and feeding the mic input directly into the recording, there were also professional photographers hired to capture the essence of every room at all times. The sound was amazing, and the facemics the speakers had produced zero crackling and noise – everything was crystal clear. The venue was fantastic, the rooms were high tech, and – something you don’t see often in conferences – the WiFi was absolutely awesome. At one point, an entire room of 30-odd people had to perform a Composer Install command on a Symfony project, and while I could see Ryan silently praying it would work, there was no need for divine intervention – we all successfully installed everything. Not a single hiccup.

Next year, I’m first in line for an early bird ticket, and you should be standing right behind me – you won’t regret it. Just have a look at some of the photos. In the meanwhile, let me see if I can get hold of some of the talk recordings and slides and share them with you. I’ll update this post accordingly!

Note: all photos included above are taken from eZSummerCamp’s Facebook Page and copyrighted to them