Slides from my talk on Domain Specific Languages at PF-Congress, 2010.
Original synopsis:
While external Domain Specific Languages has always been a natural part of PHP development, the recent awareness of the internal DSL style of programming has been relatively slow to enter the PHP world.
In this talk I'll give a short introduction to DSL's and the difference between the external and internal style. I'll then focus on the internal DSL style and show some common techniques and patterns used in the PHP world, giving examples as we move along.
9. ""Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems."" -- Jamie Zawinski
10. when customer purchase (car) withdraw (priceof car) from (customer account) External style
15. $bowling = new Bowling; describe($bowling)-> score->should()->be(0)-> when('When bowling has not yet started'); describe($bowling)-> score->shouldNot()->beGreaterThan(0)-> when('When bowling has not yet started'); PhpSpec
24. stream_wrapper_register Allows you to implement your own protocol handlers and streams for use with all the other filesystem functions (such as fopen(), fread() etc.).