Earlier this year one of my colleagues told me during the daily scrum that he plans to attend the PHP conference PHPDay in Verona, Italy. I thought that was an excellent idea and bought a ticket the same day. It turned out that at the same time and place also the JSDay would take place, the first Javascript conference in Italy ever. That was just perfect since so far I was always a little scared of writing Javascript because I had basically no experience in doing so. I'm not saying that I became a Javascript expert just by attending a JS conference, but I surely learned a lot :-).

So in the end we were three Liipers to set off for Verona and we were about to meet some more there (including two ex-Liipers). So Liip was quite well represented, which was also noticed by the organizers ;-).The two conferences were hosted by the italian PHP user group and the guys did an awesome job. Hey, they even produced a PHPDay shirt for girls. According to them they are the first PHP conference doing so. So, thumbs up.So, what did we actually learn during those four awesome days in Italy?

JSDay

The introduction talk “Even Faster Websites” was given by Steve Souders and he talked about how to improve the loading time of a website and also the users perception of that loading time. The sooner the user gets some feedback the faster the website is in his eyes. And to make sure users get feedback as soon as possible we should make sure that loading and execution of Javascript files do not block the loading of the rest of the website. More information can be found in the book of the same name by Steve Souders or parts of it were also presented by Pierre Spring in one of his techtalks.Moreover I attended talks about the current state of HTML5 ( slides), introductions to node.js ( slides) and backbone.js, a very colorful introduction to two Javascript frameworks Cappuccino and SproutCore, two frameworks based on the idea of Mac's Cocoa framework, ( colorful slides) and last but not least a talk about OOP in Javascript by Pierre Spring ( slides).

PHPDay

Caching

For me PHPDay started with a workshop about caching by Fabien Potencier, starting off with the question about who in the room has already read the HTTP specification. We learned a lot about the different caching headers and what impact they have in what server setup. After the theory we played around with the different headers with a small silex app. Find more details about that workshop in the blog post by Patrick Zahnd.

RESTful web services

Another very interesting talk was given by David ZĂźlke, chief developer of the Agavi framework, about how to define RESTful web services. With real world examples of badly designed APIs (e.g. the twitter API) and explaining how it could be done better he explained very well what is important when designing RESTful web services. Find more details about that talk in the blog post by Patrick Zahnd.

Profiling your PHP application

Lorenzo Alberton suggested in this talk some tools that can be used to profile your PHP application, mainly xhprof that was developed by facebook. He also explained how to interpret the results of such a profiler and where to start looking for possible problems. Some examples:– if a website accesses the database, these calls should usually be at the top when sorting the profiler data by CPU usage– when sorting the results by number of function calls find out if that function really needs to be called that often or is the call maybe in the wrong place, e.g. inside a loop where it could also be outsideHe also gave some hints on how to optimize some things on system level, for example:– if you don't use htaccess files turn it off in your server config, otherwise the server searches for those files needlessly– always put a favicon.ico into your project so there is no error and the 404 error handler is not triggered in the case where you use a frameworkFind more interesting optimizations here.Oh, and by the way, don't use PHP error suppression. One reason is what PHP does when it encounters an @: it sets the error reporting level to 0, executes the function, formats the error messages and only then it actually checks the error reporting level. More reasons why you should not use it can be found here.I've also seen a talk about how dependency injection works ( slides) and from the same guy a talk about how to test untestable code, giving some ideas about how to mock certain services like mailing in non-tested legacy applications so they can be tested ( slides).

Conclusion

The talks were very interesting, the venue was beautiful (go to Verona if you've never been there, best next year for the PHPDay 2012 ;-)) and people were awesome.See you at PHPDay 2012!!!