Jeroen Moors


PHP UK Conferences 2014: Some notes
Written on 23 February 2014

I was in London the other day, at a conference, an interesting php conference. These are my notes. They’re notes I made, so they’re subject to my interpretation and personal interests.

PHP At The Firehose Scale

Stuart Herbert

  • PHP can be used to consume and process large amounts of data, however if you require insane performance C will server you better.
  • PHP application can be create quickly and allow rapid changes. If you need flexibility, PHP overpowers C.

Unbreakable Domain Models

Mathias Verraesslides

  • Domain driven development wants you to spit your application in classes serving one and only one purpose.
  • A customer class for instance should not be doing e-mail address validation. The e-mail address is managed via a separated e-mail class. I think this kind of classes are called value objects. Their constructor is used to pass in a value and validate this value if required. This technique moves the logic of each different domain into a separated block with a single purpose. Ensuring maintainability and consequent behavior throughout your application.

Caching Best Practices

Eli Whiteslides

  • Always try to cache the largest reusable piece of data in it’s most final form. For example you query data, do some transformations on it and return this data as json, cache the json object. If this data only is rarely returned as json and for instance also returned as html, cache the preprocessed data.
  • Cache everything forever and invalidate or even update the cache when things changes. Eli wasn’t that strict about the forever, I am 🙂
  • Running multiple small queries that you can cache in APC or memcached, can be more efficient as  running a single query that can’t be cached.
  • In MySQL, each update of a table invalidates the cached results of all queries using that table. Don’t rely to much on the MySQL caching.
  • In APC you can store all kinds of PHP objects, that does include resources.

Profiling PHP Applications

Bastian Hofmannslides

  • You’ll have to measure the behavior of your full stack or you’ll end up in endless discussions and try to search for a needle in a gigantic haystack.
  • End-to-end measurements can be quite easy achieved today with the Navigation Timing API. They’re not supported by all browsers, but should be supported by enough of your users to provide useful data.
  • Let the Navigation Timing API record the data and have your page make an AJAX request when it’s loaded. Make use of query parameters (log.html?dns=200&total=820) to push the data back to a server. This can be a separated server only used for data collection. The page on the server doesn’t require any logic. Just make sure you’ll enable logging of the query sting in your webserver.
  • Parse the webserver logs of your data collection server with a logstash and feed them to graphite.
  • If you use a framework as ZF or Symphony, use their browser toolbars.
  • Check bonus slides!

Algorithm, Review, Sorting

Speaker: Rowan Merewoodslides

  • Rowan is a great speaker
  • Sorting algorithms are only understandable for above intelligent people. All other should just accept their existence and behavior.
  • PHP has build in support for sorting, use these functions, don’t try to write your own

I saw also two talks on security. No big surprises there, but check their slides: Facebook’s Approach to Common Web Vulnerabilities (Ben Mathews) and Web Security and You (Eli White).