PHP
Article

PHPSummerCamp Review

By Bruno Skvorc

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

  • Ivo Lukač

    Thanks Bruno for a very nice article and recognising the effort we have put into the event. Speak to you soon (I am out of the country this week)

    • http://www.bitfalls.com/ Bruno Skvorc

      Thanks for having me, and really, really well done, above all expectations!

  • https://www.peternijssen.nl/ Peter Nijssen

    Damn. That sounds like an event I should have been at. Working a lot with Symfony these days and I am eager to learn Behat, Mink and PHPSpec.

    Regarding your Symfony remarks. I guess the applications you created were “to small” to use Symfony for. When you are working on bigger projects, you can see the advantages better I believe. Although frameworks like Laravel these days are probably even allowing you to develop “faster” and “easier” with the same kind of quality as a tool build on top of Symfony.

    • http://www.bitfalls.com/ Bruno Skvorc

      It’s a good topic for discussion, no doubt. Maybe you can join us next year :)

  • dantleech

    Hi Bruno, Thanks for the feedback, and was good to meet you :)

    I did initially create a “workshop” version of the tutorial, but after running through it more than a few times I decided it would be better to follow the actual tutorial – in that way people could have a running reference and would also be introduced to the tutorial as a resource. I don’t know if people would have benefited more from a different format — but at least they didn’t need to take notes.

    The component which initially checks the CMF Router before falling back to the default Router is called the “chain router” and is a part of the Routing component, not the RoutingAutoBundle. The routing auto component generates the URL entries in the database automatically based on a schema which can use dynamic tokens (which are normally sourced from the content itself).

    PHPCR would have been a real challenge to sufficiently explain in the workshop, but perhaps it might have been possible to clarify it more.

    The CMF is meant for Symfony users, so we assume that there is a reason that the dev. is not using WordPress (perhaps they already have a Symfony app, or don’t like developing in WordPress, or want more flexibility in the future).

    The aim of the CMF (imo) is that you use the bundles and components as building bricks to produce the CMS that you want, that you understand and that you control.

    For sure my presentation skills could have been better (that was my first conference), but its a learning process :)

  • http://www.bitfalls.com/ Bruno Skvorc

    Hi Dan,
    thanks for clarifying!

    While I am aware of the aim of the CMF, it still seemed like somewhat of an overkill to do all that just for the very simple functionality we got in the end. Even the CMF tutorial itself not only mentions that the bundles used are unstable, but it, on several occasions, sends the reader elsewhere to install additional bundles and libraries unexpectedly. This seems overly complex and intimidating to the average user, additionally complicated by the esoteric nature of PHPCR.

    So anyway, like I said at dinner, a “PHPCR for mortals” post would be a godsend and a very good starting point for all interested parties :) Let me know if you’d like to give it a shot!

    • dantleec

      I think it only sends you elsewhere (but still in the CMF docs) at the beginning of the tutorial, for installing the PHPCR-ODM. This is because the installation instructions for the PHPCR-ODM are general (they were originally part of the tutorial, but we thought we might have other tutorials so it was split – this might change in the future).

      RoutingAutoBundle is, at time of writing, an “RC” version and has “RC” dependencies, but this will be fixed in the next week or so when version 1.2 of the CMF is released.

      Will let you know about an article :)

  • Taylor Ren

    Great to see that Symfony is in the center of the stage. It looks like an event that I should join!

    • http://www.bitfalls.com/ Bruno Skvorc

      You should :)

  • Edi Modrić

    Thanks Bruno for the nice words about Netgen and Summer Camp :)

    I would just like to clarify why I didn’t use Vagrant when setting up the appliance, although I wanted to. Based on our experiences from last two years, Summer Camp sees attendees with various levels of knowledge and this year is no exception.

    I felt that there would be much more problems with virtual appliance if we used Vagrant, instead of the regular VirtualBox machine. Probably some of the attendees never even heard of it, and it’s kinda hard to explain what Vagrant is over couple of e-mails with instructions.

    Regards,

    Edi

    • http://www.bitfalls.com/ Bruno Skvorc

      Makes sense, but I think many who don’t know about Vagrant also don’t know what a VM appliance is, and using one is as simple as using the other, in my opinion. Nevertheless, the appliance worked great and everyone ended up being able to run everything they were supposed to – regardless of host platform – well done!

      • http://amitgupta.in/ Amit Gupta

        Actually I can understand somewhat why Vagrant was not used. Chances of a Vagrant VM messing up are a bit more, unlike giving an appliance which would pretty much require you to just hit the start button. Frankly, I’ve seen a number of Vagrant setups & Homestead so far seems like the only painless one which doesn’t messes up. I still don’t like Vagrant much & prefer my own VM setup. ;)

  • http://amitgupta.in/ Amit Gupta

    Nice, that sounds like 3 fabulous days. Maybe next year I’ll join in the fun. :)

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in PHP, once a week, for free.