Skip to main content

PHPBenelux 2014

27 Jan 2014
Tags: conference php php-benelux

Last weekend, the annual PHPBenlux conference took place. With a small delegation of the Phpro crew, I went to Kontich for 2 days filled with talks, discussions and pleasure. In this article you can find a small summary of the talks that inspired me.

Day 1:

Keynote: Mentoring developers

It won't be a surprise if I told you that the conference opened with a motivational keynote. Elizabeth Marie Smith took us back to her childhood and told us why and how she started with programming. It reminded me of the time when I wrote my first super flashy website and of my first steps in PHP development. When you start learning something new, you NEED somebody to look up to. This will help you grow so much faster. In a next stadium it is your turn to give something back. Help the people around you that need your help, but DON'T spoon-feed the n00b.

What hackers do once they get passed your code

In this first session, Mattias Geniar showed us what hackers can do once they get passed your code. A presentation filled with clear examples on how hackers will try to gain and remain access to your server. Most of the time, hackers will use automated tools to find a weak point in your code. Once they have found this weak spot, they will try to compromise your website. This can be done by injecting obfuscated 'eval' scripts into your website. Or worse: Injecting a complete backdoor shell on which hackers can fully control your hosting environment.

Refactoring to Design Patters

In this talk, Benjamin Eberlei gave us a hands-on demo on refactoring. One of his first quotes was an unquestionable statement: "Neglecting Object-Oriented design leads to under-engineering, but focusing soley on Design-Pattern leads to over-engineering". Next he started with his demo, in which he made small changes to a legacy controller. By making these small changes, it was very clear were the Factory, Facade and Strategy patterns were needed. Some tips to keep in mind:

  • Get in control on how objects are created and centralize object creation.
  • Refactor step by step, otherwise you will be debugging all the time.

PHP Performance Under the hood

The last talk of the day was brought to us by Davey Shafik. It was a rather heavy subject to close the day with, but it gave a good oversight of what happens in PHP internally. Nice to see how the PHP code gets tokenized, transformed into opcodes which are interpreted into memory. What I wrote down for my day to day tasks is to make sure Zend OPcache is enabled on production environments.

Day 2:

Models and Service Layers; Hemoglobin and Hobgoblins

It was still early in the morning and apparently nobody had it's first coffee yet. Anyway, the first talk of the day, with a rather strange title, was given to us by a rather strange headed guy named Ross Tuck. He prepared some great slides for us, in which he warned us that he had an average of 1 slide per 14 seconds. The talk itself turned out to be about Domain Design Patterns. By showing some easy examples, he explained why you should be using fat model / skinny services, CQRS and Event Sourcing. This was a very enlightening talk for the project I am currently working on.

Moving Away from Legacy code with BDD

This was one of the talks I really looked forward to, given by Konstantin Kudryashov (aka everzet). As a BDD evangelist, he explained why it is better to promise less features, but more business value to a customer. This can be done with a BDD-Pipeline in which we handle some stages before starting refactoring the code:

  • Impact Mapping
  • Feature mapping
  • Order the tasks by role and benefit
  • Describe features into example scenarios
  • Describe, Implement, Design
The last 2 steps is where Behat and Phpspec come into play. Some really nice testing tools, to describe and validate how your application and models should behave.

Maximising Performance in ZF2

Another talk on my TODO list was this one, brought to us by Gary Hockin. In the first part he told us how he benchmarks and profiles his ZF2 applications. This was mainly with the tools Siege and Xdebug. Next he gave us some very helpful tips on how to increase performance in ZF2:

  • Use EdpSuperLuminal on production
  • Turn on Zend Opcode caching on production.
  • Do not place closures in config file, place them in the Module.php file.
  • Place popular routes in the and of your configuration. The router is a LIFO stack. Note: Take care of module order.
  • Use View template maps in production instead of the template_view_stack. This can be done with the default templatemap_generator.php, shipped with zend.
  • Minimize the use of the shared event manager.
  • Cache big datasets.
  • Add default files like favicon.ico, robots.txt, ... to make sure ZF2 does not get bootstrapped on request.

Uncon: Feature branches & PR’s

This year, there was also an Uncon going on at PHPBenelux. The first session I followed, was a small talk about PhlyBox by Pascal de Vink. At this moment, the tool doesn't do much. It is just a PoC for something that might become powerfull. It is designed to make it easier to deploy feature branches to a specific environment. I have thought about the concept myself, but don't think this is the way to go. Basically, the tool spawns new vagrant boxes with a custom branch as source. I think it would be easier to use a tool like grunt-git to clone a branch to a specific directory and create a new VirtualHost that will redirect to the branch. Then the only thing that remains a problem, is running database migrations. So, I guess there is still a lot of stuff to think through.

Uncon: Queue your work; about job queues and abstraction layers

The next part of the Uncon was a talk about Queueing and Messaging systems in PHP, brought to us by Jurian Sluiman. All the actions that users don't need to be aware of, should be done asynchronous. This way, you can deliver the content to the user in no time and let the server do the other jobs when there are resources to do the task. A good way to do this kind of asynchronous data handling, is by using queue deamons like Gearman or Beanstalkd. A Job Server will remember what tasks that need to be done and a Job Worker will handle the actions and give a response to the Task Server. When you need more control over the Messaging, you can use a Messaging Queues like ZeroMQ or RabbitMQ. This was a really interesting topic. I can't wait to add this asynchronous queues into a next project.

Extract Till You Drop

The last talk was about extracting legacy code. Mathias Verraes gave us a live demo, a bit similar to the talk of Benjamin Eberlei. It was great to watch how Mathias used all the build-in PhpStorm refactoring macro's. He also had a very interesting way in naming stuff. Exactly what you would expect from a DDD evangelist! The tests ran in PHPUnit, but had a BDD like structure. It looked like a mixture of PhpUnit, PhpSpec And Behat.

Conclusion

PHPBenlux was, again, a great conference. It's amazing to see how the sessions and socials improve every year. To all the organizers: keep up the good work! I hope to be there again next year.

whois VeeWee

Selfie

Hi there!

Glad you made it to my blog. Please feel free to take a look around. You will find some interesting stuff, mostly about web development and PHP.

Still can't get enough of me? Quick! Take a look at my Speakerdeck, Twitter, PHPC.Social, or Github account.