PHPucEU 2013 | Saturday, Session 01, Room 01

Topic: Split up your platform to components


Bastian Hofmann,

Example based talk about how split up large sites to small components
and how this will help with development because of heavy code reuse.

Example based on

How are components build at researchgate
- php file (controller per components)
- (mustache) template
- renderd via v8js pecl extension on php side
- sometimes a javascript view
- binded just to the single component via uniqid per componentn
- sometimes component specific css
- most time it's side wide "global styling"

every component is renderable at front and backend

every component has a own endpoint

different rendering methods possible

- simple render everything on server and send it to the client
- lazy loading/reloading via ajax possible
- bigpipe of facebook
- render important/not backend heavy stuff first
- flush the generated html to client
- now do the heavy stuff and write it in a script tag to render at the frontend
- and flush again
- this ends up in the feeling of a faster page

components are self contained
- components have requirements
- because lots of components could have same requirements collecting them at firts
by a central component that injectes the requirements to the component
- the central requirement collector can batch datarequests
- multigets to memcache
- start lots of http requests in the background and do other stuff in the meantime till they are return data
- select * FROM table where id IN (list of ids)
lots of "select * FROM table where id = X"
- requiremtns of requirements will may be ugly
- generators in php 5.5 will be cool!?

components can be build up out of other components (more code reuse)

components help at A/B testing
- just replace one component with another
- use a componentn that loads different variants of it self






Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License