TYPO3 Flow 2.0 in the field - webtech Conference 2013

7,240 views
7,102 views

Published on

Slides of the talk: "TYPO3 Flow 2.0 in the field" / webtech Conference 2013 by Patrick Lobacher (CEO typovision GmbH) / http://webtechcon.de / 29.10.2013

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

  • Be the first to like this

No Downloads
Views
Total views
7,240
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

TYPO3 Flow 2.0 in the field - webtech Conference 2013

  1. 1. Patrick Lobacher | typovision GmbH | 29.10.2013 TYPO3 Flow 2.0 in the Field
  2. 2. Agenda • What is TYPO3 Flow? • Installation • Base paradigms • In the field • What else is inside TYPO3 Flow? • What‘s new in TYPO3 Flow? Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  3. 3. What is TYPO3 Flow? Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  4. 4. TYPO3 Flow is a PHP web application platform enabling developers creating excellent web solutions. Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  5. 5. History • • Versions • • • • FLOW3 1.0.0 alpha1 / 02.06.2009 (started in 2005) FLOW3 1.0.0 / 20.10.2011 FLOW3 1.1.0 / 24.08.2012 (Rebranding in October 2012) TYPO3 Flow 2.0 / 12.07.2013 Background • • • Written by the TYPO3 community from scratch to have a solid code base for the next generation CMS TYPO3 Neos Influenced by viFramework, Spring Framework, AspectJ, NanoContainer, Ruby on Rails, Symfony, QT, Doctrine and surely more Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  6. 6. Features • • • • • • Domain Driven Design • • • HTTP-Support Aspect-Oriented Programming Dependency Injection Model-View-Controller Property Mapping & Validation Convention over Configuration Resource Management • • • • • Security • • • Error & Exception Handling Session Handling Command Line Cloud ready Internationalization & Localization TDD & Debugging Speed & Performance Templating Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  7. 7. Requirements • • • • Supported operation systems • • • Linux Mac OS X Windows (Vista or later) Supported HTTP server plattforms • • • Apache 2 NGINX IIS PHP 5.3.2 or higher All systems supported by Doctrine 2 ORM can be used Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  8. 8. Installation Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  9. 9. Installation Download of Composer (Dependency Manager for PHP) curl -s https://getcomposer.org/installer | php Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  10. 10. Installation Download of TYPO3 Flow via Composer: composer create-project --dev --keep-vcs typo3/flow-basedistribution flow 2.0.0 Link to Document Root (which is flow/Web) rm htdocs ln -s flow/Web htdocs (Use composer update to update installation) Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  11. 11. Directory structure Directory Description Configuration/ Application specific configuration, grouped by contexts Data/ Persistent and temporary data, including caches, logs, resources Web/ Public web root flow Flow command line tool Build/ Build files (e.g. Surf) Packages/ Contains sub directories which in turn contain package directories Packages/Framework/ Packages which are part of the official TYPO3 Flow distribution Packages/Application/ Application specific packages Packages/Libraries/ 3rd party libraries bin/ Helper functions Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  12. 12. File permissions Most of the directories and files must be readable and writable for the user you're running TYPO3 Flow with. This user will usually be the same one running your web server (httpd, www-data, www or _www on most Unix based systems). Set permissions • 1. Parameter: Shell-User • 2. Parameter: Webserver-User • 3. Parameter: Webserver-Group sudo ./flow core:setfilepermissions patricklobacher _www _www Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  13. 13. Groups Now that the file permissions are set, all users who plan using TYPO3 Flow from the command line need to join the web server's group. On a Linux machine this can be done (for user patricklobacher and group _www) by typing: sudo usermod -a -G _www patricklobacher On a Mac type sudo dscl . -append /Groups/_www GroupMembership patricklobacher Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  14. 14. Web server configuration Assuming that you chose Apache 2 as your web server, simply create a new virtual host by adding the following directions to your Apache configuration (conf/extra/httpdvhosts.conf on many systems; make sure it is actually loaded with Include in httpd.conf): httpd.conf: <VirtualHost *:80> DocumentRoot /var/apache2/htdocs/flow/Web/ ServerName flow.dev SetEnv FLOW_CONTEXT Development </VirtualHost> <VirtualHost *:80> DocumentRoot /var/apache2/htdocs/flow/Web/ ServerName flow.live SetEnv FLOW_CONTEXT Production </VirtualHost> <Directory /var/apache2/htdocs/flow/> AllowOverride FileInfo Options=MultiViews </Directory> Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  15. 15. Web server configuration Add the following line to your /etc/hosts file (C: windowssystem32driversetchosts on Windows): 127.0.0.1 flow.live flow.dev Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  16. 16. Set up database Copy Settings-File: cp Configuration/Settings.yaml.example Configuration/Settings.yaml Edit Configuration/Settings.yaml (2 blanks indent): TYPO3: Flow: persistence: backendOptions: host: '127.0.0.1' dbname: 'flow' user: 'root' password: 'password' # # # # adjust adjust adjust adjust to to to to your your your your database database database database Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field host name user pass
  17. 17. Migration If you configured everything correctly, the following command will create the initial table structure needed by TYPO3 Flow: ./flow doctrine:migrate Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  18. 18. Testing Now call the following URL in your browser http://flow.dev/ Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  19. 19. Base Paradigms Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  20. 20. Domain Driven Design • • • An approach which ... • • • results in rich domain models provides a common language (ubiquacross the project team simplify the design of complex applications The premise of TYPO3 Flow is: • Placing the project's primary focus on the core domain and domain logic • • Basing complex designs on a model of the domain Introducing an ubiquitous language which concerns all assets TYPO3 Flow is the first PHP framework tailored to Domain-Driven Design Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  21. 21. Domain Driven Design DDD Model (incl. ubiquitous language UL) Domain Object (Entity,Value Object) Aggregate (Aggregate Root) Repository Service Relation Strategic Pattern (Sub-/Domain, Bounded Context, Context Map) Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  22. 22. MVC Model View Controller Stack (DVC) Domain/ Model/ Repository/ Validator/ Controller/ View/ Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  23. 23. In the field a step-by-step example Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  24. 24. Domain Model We assume a pretty simple domain Model: n Blog title Post title description posts 1 Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  25. 25. Kickstart the package Let's create a new package Blog inside the vendor namespace IPC: ./flow kickstart:package IPC.Blog If you want to have more information about the commands, you can use: ./flow help ./flow help kickstart:package Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  26. 26. Kickstart the package Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  27. 27. Kickstart the package Now call the package: http://flow.dev/IPC.Blog Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  28. 28. Kickstart Controllers If you compare with our domain model we need a controller for the Domain Model „Post“. We also need a SetupController which initially sets up the blog. Create them with the kickstarter as well: ./flow kickstart:actioncontroller IPC.Blog Setup Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  29. 29. Kickstart Controllers Kickstart PostController (and all related files): ./flow kickstart:actioncontroller --generate-actions -generate-related IPC.Blog Post Update database: ./flow doctrine:update Test them with: http://flow.dev/IPC.Blog/Setup http://flow.dev/IPC.Blog/Post Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  30. 30. Kickstart Blog Model Kickstart Blog Model: ./flow kickstart:model IPC.Blog Blog title:string description:string 'posts:DoctrineCommonCollections Collection' ./flow doctrine:update Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  31. 31. Kickstart Blog Model Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  32. 32. Edit Blog Model Edit Blog Model to look like the following(Packages/Application/ IPC.Blog/Classes/IPC/Blog/Domain/Blog.php): Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  33. 33. Add to Blog Model Add to Blog Model to look like the following(Packages/Application/ IPC.Blog/Classes/IPC/Blog/Domain/Blog.php): Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  34. 34. Kickstart Post Model Kickstart Post Model: ./flow kickstart:model --force IPC.Blog Post 'blog:IPCBlog DomainModelBlog' title:string linkTitle:string date: DateTime author:string content:string ./flow doctrine:update Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  35. 35. Edit Post Model Edit Blog Model to look like the following(Packages/Application/ IPC.Blog/Classes/IPC/Blog/Domain/Post.php): Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  36. 36. Kickstart Blog Repository Kickstart Blog Repository: ./flow kickstart:repository IPC.Blog Blog Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  37. 37. Repository • There are „magic“ methods available • • • • • • • • add remove update findAll findBy[PropertyName] findOneBy[PropertyName] count countBy[PropertyName] Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  38. 38. Repository - Examples Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  39. 39. Setup - Controller - 1 Edit Setup Controller to look like the following (Packages/Application/IPC.Blog/ Classes/IPC/Blog/Controller/ SetupController.php): ./flow doctrine:update Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  40. 40. Setup - Controller - 2 Edit Setup Controller to look like the following (Packages/Application/IPC.Blog/ Classes/IPC/Blog/Controller/ SetupController.php): ./flow doctrine:update Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  41. 41. Index Action / Setup Controller Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  42. 42. Edit Blog Repository Edit Blog Repository: Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  43. 43. Edit Post Controller Edit Post Controller: Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  44. 44. Index Action / Post Controller Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  45. 45. What else is inside TYPO3 Flow? Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  46. 46. Templating via Fluid • • TYPO3 Flow has its own template engine called Fluid. Focus on the following features: • Support of logical structures (such as conditions, widgets, conditions, loops, iteration over array, ...) • • • • • No PHP code in the template file Easy to expand through ViewHelper (reusable) Simple but intuitve syntax Provide an XML structure for automated template validation Highly object oriented Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  47. 47. Templating via Fluid Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  48. 48. Templating via Fluid Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  49. 49. Persistence • Object Persistence in the Flow is • • • • • • • based on Doctrine 2 integrates seamless into Flow provides all the great Doctrine 2 features provides Doctrine 2 Migrations uses UUIDs provides a low level persistence API allows for own, custom persistence backends (instead of Doctrine 2) • e.g. Solr or CouchDB Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  50. 50. Aspect oriented programming • Loggin without AOP Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  51. 51. Aspect oriented programming • Loggin with AOP Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  52. 52. Aspect oriented programming • • AOP is used for in TYPO3 Flow for • • • • persistence magic logging debugging security • • • • • @FlowBefore @FlowAfterReturning @FlowAfterThrowing @FlowAfter @FlowAround Advices within TYPO3 Flow Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  53. 53. Security • • • • • • • • • • as many default build-in security mechanism as possible CSRF protection SQL-Injection protection Cross Site Scripting (XSS) protectipn centrally managed through AOP modeled after TYPO3 CMS and Spring Security supports authentication, authorization, validation, filtering, security policies, ... can intercept arbitrary method calls transparently filters content through query-rewriting highly extensible for new authmechanisms Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  54. 54. And many more... Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  55. 55. What is new in Flow 2.0? Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  56. 56. Lazy Dependency Injection • Consider a controller which depends on 15 other services. Not all of these are used in every action. And since most of these services may in turn depend on other services which have even further dependencies, you end up loading maybe hundreds of class files which are not needed for the particular action to be executed. • In Flow 2.0 dependencies injected through Property Injection are now "lazy" by default. Developers can uses these dependencies like before, but the instance is created and thus the class file is only loaded when the service is actually used the first time.  Apart from a few special cases this process is completely transparent to the developer. • This will increase the speed of the application enormous Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  57. 57. Safe Request Methods • The HTTP 1.1 specification states that the GET and HEAD request methods should be considered "safe", which means that they should not do anything other than retrieve information. • In Flow 2.0 we now enforce this rule by disabling the automatic persistence for "safe" request methods. • In practice this means, for example, that simple links pointing to a "delete" action will still call that action, but the delete operation will not be persisted to the database. • Since we know that there won't be data modifications in "safe" requests, we also don't need to protect links to these actions with CSRF tokens. Or, in other words, links to a “delete” action will not really delete anything, so applications must use another non-safe request method, like POST, if they want the change to be persisted. Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  58. 58. Composer • Flow 2.0 comes with a whole new package management layer based on Composer (https://getcomposer.org), the de-facto standard for PHP dependency management. • Take a few minutes reading the Composer documentation and getting familiar with its concepts. While it takes a few days getting into the new workflow, you will love  how much easier it is to use third party packages now. Just look at all the third-party libraries listed on packagist.org and you’ll begin to see some of the amazing possibilities with composer. Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  59. 59. Session • While creating a Single-Sign On Client / Server solution based on Flow, we wanted to be able to access and modify remote sessions in a multisite setup. While PHP's native session implementation does support alternative storage backends, there is no official way to modify this data, except for the currently active session. • Flow 2.0 now provides a clean session mechanism written in pure PHP. Instead of creating a whole new API for the storage, we chose to just rely on Flow's caching framework: that way you can store session data in the file system, APC, Memcache, Redis, PDO compatible databases and more. • The Session Manager now provides additional functions to retrieve arbitrary sessions by identifier or by tags. This way it is possible to tag a session, for example, with a customer number and allow a support team have a closer look at possible problems or even log out a user remotely. Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  60. 60. REST Support • Various changes added even better support for creating and consuming RESTful web services. • One important change introduces support for HTTP Method Tunneling: in situations where it is not possible to send a true DELETE or PUT request (or any other request type), it is now possible simulate the request method by sending a POST request either with a "__method" argument or with a special HTTP request header. Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  61. 61. Links Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  62. 62. Links • • • • • http://flow.typo3.org/ http://flow.typo3.org/documentation.html http://jweiland.net/flow.html http://www.typovision.de/de/ kompetenzen/typo3/ http://de.slideshare.net/plobacher/typo3neos-the-compendium Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  63. 63. Patrick Lobacher • • • • • • • • • 43 years, happily married, residing in Munich Author of 9 books and > 40 articles on the subject of TYPO3 and web development Active in the web deveopment area since 1994 Certified TYPO3 Integrator since 2009 Until 2012 member of the teams Extbase (Leader), Certification and Content editoral Until 2012 member of the EAB (Expert Advisory Board) Co-Organizer of the TYPO3camp Munich (2008-2013) and TYPO3 Developer Days (T3DD12) Speaker at national and internation conferences Lecturer for leading training institutes and MVHS Publications: Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  64. 64. typovision GmbH • Full service digital communications agency based in Munich & NRW • >40 employees (+ 15 from freelancer pool) • CEO: Sebastian Böttger (CTO), Patrick Lobacher (CMO) • Highly specialized in TYPO3 since 10 years (Extbase/Fluid since 2009) • Platinum TYPO3 Association Member since 3 Jahren • Specialized in Enterprise Search (Solr, Elastic Search) since 3 years • Focus: Premium Open Source Web Technlologies and CMS • Agency profil (german): www.typovision.de/dieagentur • More than 600 projects of any size • Vision: We are the partner of our clients in all areas of its digital communication - from the initial vision to the successful implementation and far beyond. Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  65. 65. Customers Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  66. 66. Contact Traditional: Twitter: www.twitter.com/typovision www.twitter.com/PatrickLobacher www.twitter.com/crosscontent Facebook: www.facebook.com/typovision typovision GmbH Elsenheimerstr. 7 80687 Munich Phone: +49 89 45 20 59 3 - 0 Fax: +49 89 45 20 59 3 - 29 Email: Web: info@typovision.de www.typovision.de XING: www.xing.com/companies/typovisiongmbh www.xing.com/profile/Patrick_Lobacher www.xing.com/profile/Sebastian_Boettger2 LinkedIn www.linkedin.com/company/2038844 Blog: typoblog.de Slideshare: www.slideshare.net/plobacher www.slideshare.net/typovision Trainings: academy.typovision.de Amazon: www.amazon.de/Patrick-Lobacher/e/ B0045AQVEA Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field
  67. 67. Thanks a lot! Patrick Lobacher | typovision GmbH | 29.10.2013 | TYPO3 Flow in the field

×