eZPublish meets SymfonyGaetano Giunta | phpDay 2013 | 17.5.2013
5/17/2013gg@ez.no Slide 2Not your grandpa’s CMS
This is not eZ PublishANYMORE5/17/2013gg@ez.no Slide 3Not your grandpa’s CMS
The drivers
5/17/2013gg@ez.no Slide 5Why change?The need to refactor
 Existing codebase is 10 years old  High maintenance cost Started with no unit tests - singletons everywhere Layers a...
 Existing codebase is 10 years old  Widely deployed Well debugged Pitfalls have mostly been uncovered by now Proven ...
 Focus on our core business Experience Management Content Management NOT Framework maintenance Durable Architecture ...
• Simple Integration with existing API• HMVC (Hierarchical Model View Controller) stack• Decoupled Components• Dependency ...
• Homebrew• Zeta Components• Zend Framework 2• Symfony 25/17/2013gg@ez.no Slide 10Candidates
5/17/2013gg@ez.no Slide 11And the winner is…Title of presentation is a hint, really...
5/17/2013gg@ez.no Slide 12And the winner is…
5/17/2013gg@ez.no Slide 13This is eZ Publish 5!StandardSymfony2 App.(=app)+eZ Publishbundles(PHP & REST APIs+ Legacy)vendo...
The challenge
Product Management SCRUM Story:«As an existing user, I don’t want to be pissed off by a new#@!$% version!»5/17/2013gg@ez.n...
Product Management SCRUM Story:«As an existing user, I don’t want to be pissed off by a new#@!$% version!»• 100% Data Comp...
Product Management SCRUM Story:«As an existing user, I don’t want to be pissed off by a new#@!$% version!»• 100% Data Comp...
A new architecture
Product Management SCRUM Story:«As an existing user, I don’t want to be pissed off by a new#@!$% version!»• 100% Data Comp...
5/17/2013gg@ez.no Slide 20Dual-core architectureWhere the magic is
Legacy version still works perfectly standalone5/17/2013gg@ez.no Slide 21BC: icing on the cake
Taming the beast
 New Core: a standard Simfony app Legacy stack isolated in a dedicateddirectory5/17/2013gg@ez.no Slide 23Refactoring: di...
use SymfonyComponentHttpFoundationRequest;require_once __DIR__ . /../ezpublish/autoload.php; // set up class autoloadingre...
 Sandbox legacy code in a closure Index.php had to be refactored (from 1100 lines to 20) Logic moved to a php class Se...
The ChainRouter from the Sf CMF project is used5/17/2013gg@ez.no Slide 26Routing: seamless integration
 eZ4 had an incomplete REST API Only functionality available: reading content Based on Zeta Components MVC component A...
An ongoing story
5/17/2013gg@ez.no Slide 29Version 5.1 is around the corner
Where to go from here
There’s a few tickets left!Did I tell you it’s on the sea?Want to dive in?5/17/2013gg@ez.no Slide 31
 Sf2 book – jolly good looking docs:http://symfony.com/doc/current/book/index.html eZ Publish: Community: http://share....
5/17/2013gg@ez.no Slide 33And now for something completely different
Upcoming SlideShare
Loading in …5
×

eZPublish meets Simfony2 - phpDay2013

1,938 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,938
On SlideShare
0
From Embeds
0
Number of Embeds
881
Actions
Shares
0
Downloads
11
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

eZPublish meets Simfony2 - phpDay2013

  1. 1. eZPublish meets SymfonyGaetano Giunta | phpDay 2013 | 17.5.2013
  2. 2. 5/17/2013gg@ez.no Slide 2Not your grandpa’s CMS
  3. 3. This is not eZ PublishANYMORE5/17/2013gg@ez.no Slide 3Not your grandpa’s CMS
  4. 4. The drivers
  5. 5. 5/17/2013gg@ez.no Slide 5Why change?The need to refactor
  6. 6.  Existing codebase is 10 years old  High maintenance cost Started with no unit tests - singletons everywhere Layers and roles not properly defined / documented - interdependencies OOP before php had Private/protected/static Closures Namespaces Late static binding And much more Not built for an AJAX and REST world5/17/2013gg@ez.no Slide 6Why change?Everyone loves NEW!
  7. 7.  Existing codebase is 10 years old  Widely deployed Well debugged Pitfalls have mostly been uncovered by now Proven to scale Well known: Documentation improved over years Tutorials, forums, blogs, aggregators Active community of practitioners Official training courses5/17/2013gg@ez.no Slide 7Why change?Do not forget drawbacks
  8. 8.  Focus on our core business Experience Management Content Management NOT Framework maintenance Durable Architecture API stability Battle tested / not (only) the latest trend Scalability Lively Community!5/17/2013gg@ez.no Slide 8Picking a framework for a platform rebuild
  9. 9. • Simple Integration with existing API• HMVC (Hierarchical Model View Controller) stack• Decoupled Components• Dependency Injection• Good Template Engine• Extensible, Open, Reliable ;-)5/17/2013gg@ez.no Slide 9Prerequisites
  10. 10. • Homebrew• Zeta Components• Zend Framework 2• Symfony 25/17/2013gg@ez.no Slide 10Candidates
  11. 11. 5/17/2013gg@ez.no Slide 11And the winner is…Title of presentation is a hint, really...
  12. 12. 5/17/2013gg@ez.no Slide 12And the winner is…
  13. 13. 5/17/2013gg@ez.no Slide 13This is eZ Publish 5!StandardSymfony2 App.(=app)+eZ Publishbundles(PHP & REST APIs+ Legacy)vendor/ezsystems/ezpublish-kernel+ Full-blownBack-office
  14. 14. The challenge
  15. 15. Product Management SCRUM Story:«As an existing user, I don’t want to be pissed off by a new#@!$% version!»5/17/2013gg@ez.no Slide 15Backwards compatibility(life sucks)
  16. 16. Product Management SCRUM Story:«As an existing user, I don’t want to be pissed off by a new#@!$% version!»• 100% Data Compatible (same DB scheme)• Possibility to include legacy templates in the new ones• Routing fallback• Load legacy content templates with legacy rules• Settings• Access Symfony services from legacy modules5/17/2013gg@ez.no Slide 16Backwards compatibility: the objectives
  17. 17. Product Management SCRUM Story:«As an existing user, I don’t want to be pissed off by a new#@!$% version!»• 100% Data Compatible (same DB scheme)• Possibility to include legacy templates in the new ones• Routing fallback• Load legacy content templates with legacy rules• Settings• Access Symfony services from legacy modules5/17/2013gg@ez.no Slide 17Backwards compatibility: the objectives
  18. 18. A new architecture
  19. 19. Product Management SCRUM Story:«As an existing user, I don’t want to be pissed off by a new#@!$% version!»• 100% Data Compatible (same DB scheme)• Possibility to include legacy templates in the new ones• Routing fallback• Load legacy content templates with legacy rules• Settings• Access Symfony services from legacy modulesChallenge Accepted5/17/2013gg@ez.no Slide 19BC: the challenge
  20. 20. 5/17/2013gg@ez.no Slide 20Dual-core architectureWhere the magic is
  21. 21. Legacy version still works perfectly standalone5/17/2013gg@ez.no Slide 21BC: icing on the cake
  22. 22. Taming the beast
  23. 23.  New Core: a standard Simfony app Legacy stack isolated in a dedicateddirectory5/17/2013gg@ez.no Slide 23Refactoring: directory layout
  24. 24. use SymfonyComponentHttpFoundationRequest;require_once __DIR__ . /../ezpublish/autoload.php; // set up class autoloadingrequire_once __DIR__ . /../ezpublish/EzPublishKernel.php;$kernel = new EzPublishKernel( dev, true ); // extends the Sf Kernel class$kernel->loadClassCache(); // a method from parent class$request = Request::createFromGlobals();$response = $kernel->handle( $request );$response->send();$kernel->terminate( $request, $response ); The Kernel class wraps the HTTPKernel It adds a Service Container It allows to register bundles via registerBundles()5/17/2013gg@ez.no Slide 24The new frontend controllerUsing Symfony HTTP Kernel
  25. 25.  Sandbox legacy code in a closure Index.php had to be refactored (from 1100 lines to 20) Logic moved to a php class Separated environment setup from execution and teardown runCallback() sets up the global legacy environment5/17/2013gg@ez.no Slide 25Refactoring: bridging Legacy code
  26. 26. The ChainRouter from the Sf CMF project is used5/17/2013gg@ez.no Slide 26Routing: seamless integration
  27. 27.  eZ4 had an incomplete REST API Only functionality available: reading content Based on Zeta Components MVC component A new API has been implemented Full reading and writing of content is possible All “dictionary” data is also available Content-type for response can be JSON or XML (with an XSD!) Fully restful Usage of all HTTP verbs (and then some: PATCH) Respect http headers of request (eg: “Accept”) HATEOAS: use urls as resource ids No separate request handling framework needed: pure Symfony routing Bonus points: a client for the REST API, implements the same interfaces exposedby the local PHP API – network transparency!!!5/17/2013gg@ez.no Slide 27REST API
  28. 28. An ongoing story
  29. 29. 5/17/2013gg@ez.no Slide 29Version 5.1 is around the corner
  30. 30. Where to go from here
  31. 31. There’s a few tickets left!Did I tell you it’s on the sea?Want to dive in?5/17/2013gg@ez.no Slide 31
  32. 32.  Sf2 book – jolly good looking docs:http://symfony.com/doc/current/book/index.html eZ Publish: Community: http://share.ez.no Source code: https://github.com/ezsystems API docs: http://pubsvn.ez.no/preview.html Slides soon on Slideshare Contact me: @gggeek, gaetano.giunta@ez.noTHANK YOU5/17/2013gg@ez.no Slide 32The usual suspects
  33. 33. 5/17/2013gg@ez.no Slide 33And now for something completely different

×