SlideShare a Scribd company logo
1 of 62
Download to read offline
Welcome to the

Hitchhiker's Guide to FLOW3
Overview
     Hello FLOW3!
     Configuration
     Bootstrap
     Packages
     Components
     Caching
     More




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Getting Started


Hello FLOW3!
The Hello World example based on FLOW3's
Model-View-Controller Framework.




                                           Inspiring people to
Hitchhiker's Guide to FLOW3                share
Getting Started


5 Easy Steps
  1.   Download FLOW3

  2.   Adjust write permissions

  3.   Create a new package

  4.   Create a default controller

  5.   Create a default action




                                     Inspiring people to
Hitchhiker's Guide to FLOW3          share
Getting Started


1. Download FLOW3
Just checkout the FLOW3 distribution via
Subversion:

svn co http://svn.typo3.org/FLOW3/dist/trunk/




                                                Inspiring people to
Hitchhiker's Guide to FLOW3                     share
Getting Started


2. Adjust write permissions
Make sure that the public folder is writeable for
the webserver's user:

sudo chown -R robert:www public/
sudo chmod -R 770 public/




                                                    Inspiring people to
Hitchhiker's Guide to FLOW3                         share
Getting Started


3. Create a package
In order to create a new package, just create
a new folder within the Packages directory.




                                                Inspiring people to
Hitchhiker's Guide to FLOW3                     share
Getting Started


4. Create a Default Controller
1. Create a "Classes" directory

2. Create a "Controller" directory

3. Create a class file

4. Extend FLOW3's action controller




                                      Inspiring people to
Hitchhiker's Guide to FLOW3           share
Getting Started


5. Create Default Action




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Configuration




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Configuration


Configuration Format
       The default configuration format is PHP

       Configuration options reside in a configuration object

       The configuration object provides array access and a fluent interface

       Configuration options are self-documenting




                                                                             Inspiring people to
Hitchhiker's Guide to FLOW3                                                  share
Configuration


Configuration Format




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Configuration


Configuration Types
       FLOW3 distinguishes between different configuration types for
       different purposes:

          FLOW3 - reserved for FLOW3 configuration

          Package - package related configuration

          Component - configuration for components, including
          Dependency Injection

          Routes - special configuration for defining MVC routes

          Settings - mainly user-level settings for any purpose


                                                                      Inspiring people to
Hitchhiker's Guide to FLOW3                                           share
Configuration


Configuration Types




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Configuration


The Cascade
       Each package defines possible configuration options by setting
       default values

       Default configuration can be altered by user-defined configuration
       files

       User configuration can only modify existing configuration options

       Modifying non-existent configuration options results in an error




                                                                         Inspiring people to
Hitchhiker's Guide to FLOW3                                              share
Configuration


Application Context
       An application context is a set of configuration for a specific context

       FLOW3 is shipped with configuration for these contexts:

          Production
          Development
          Testing
          Staging

       FLOW3 is always launched in one defined context

       Additional, user-defined contexts are possible


                                                                               Inspiring people to
Hitchhiker's Guide to FLOW3                                                    share
Configuration


Application Context
       Configuration defined in the top level of a Configuration directory is
       the base configuration

       Specialized configuration for application contexts reside in
       subdirectories named after the context

       Application context configuration overrides the base configuration




                                                                             Inspiring people to
Hitchhiker's Guide to FLOW3                                                  share
Configuration


Application Context




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Bootstrap       (or: how to launch a rocket)




                                               Inspiring people to
Hitchhiker's Guide to FLOW3                    share
Bootstrap


Public/index.php
       This file is the default main script

       It launches FLOW3 in the Production context

       The webserver's web root should point to the Public directory




                                                                       Inspiring people to
Hitchhiker's Guide to FLOW3                                            share
Bootstrap


Public/index_dev.php
       This script is used for development

       It launches FLOW3 in the Development context

       More scripts like this can be created for additional contexts




                                                                       Inspiring people to
Hitchhiker's Guide to FLOW3                                            share
Bootstrap


Public/index_dev.php
       Don't forget to run FLOW3 in Development context while you're
       developing because

            component configuration is cached in production mode, so new
            classes won't be recognized

            resources are cached in production mode, so changes won't be
            detected

            and many more things might be cached which lead to unexpected
            errors if you change some code in your package




                                                                            Inspiring people to
Hitchhiker's Guide to FLOW3                                                 share
Bootstrap


$FLOW3->run()
       run() is a convenience method which

            initializes the FLOW3 framework

            resolves a request handler

            handles and responses to the request




                                                   Inspiring people to
Hitchhiker's Guide to FLOW3                        share
Bootstrap


$FLOW3->initialize()
       The initialization process is divided into different stages:

            Initialize FLOW3

            Initialize the packages

            Initialize the components

            Initialize the settings

            Initialize the resources

       The configuration for each level can't be changed once the initialization level is reached



                                                                               Inspiring people to
Hitchhiker's Guide to FLOW3                                                    share
Packages




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Packages


Package Manager
      Like the good old Extension Manager - but without UI yet

      Scans the Packages directory for packages

      Will connect to the FLOW3 Package Repository

      Package file format is just plain .zip

      Will provide access via Web / CLI and offer Web Services




                                                                 Inspiring people to
Hitchhiker's Guide to FLOW3                                      share
Packages


Meta/Package.xml
      Contains meta information about a FLOW3 package

      The format is defined by a RelaxNG schema:
      http://typo3.org/ns/2008/flow3/package/Package.rng

      The Package.xml will soon be mandatory




                                                          Inspiring people to
Hitchhiker's Guide to FLOW3                               share
Components




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Components


Components
      Components are re-usable, properly encapsulated objects

      The lifecycle of a component and the combination of active
      components is managed by the Component Manager

      All classes in the TYPO3 context are considered as components

      Components are configurable




                                                                      Inspiring people to
Hitchhiker's Guide to FLOW3                                           share
Components


Class ≙ Component
      Classes are automatically registered as components if

         they reside in the Classes directory of a package and

         their name follows the FLOW3 naming conventions




                                                                 Inspiring people to
Hitchhiker's Guide to FLOW3                                      share
Components


Example




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Components


Playing with building blocks
      The combination of components used is configurable
      (orchestration)

      The less components know about each other the easier it is to reuse
      them in a variety of contexts

      Create your own LEGO set by creating cleanly separated, decoupled
      components!




                                                                            Inspiring people to
Hitchhiker's Guide to FLOW3                                                 share
Components


Component Dependencies
      Components seldomly come alone

      Components depend on other components which depend on other
      components which ...

      Problem:

        Components explicitly refer to other components:
        $phoneBookManager = new PhoneBookManager




                                                                    Inspiring people to
Hitchhiker's Guide to FLOW3                                         share
Components


Dependency Injection
      A component doesn't ask for the instance of another component but
      gets it injected

      This methodology is referred to as the "Hollywood Principle":
      "Don't call us, we'll call you"

      Enforces loose coupling and high cohesion

      Makes you a better programmer




                                                                          Inspiring people to
Hitchhiker's Guide to FLOW3                                               share
Components


Constructor without Dependency Injection




                                  Inspiring people to
Hitchhiker's Guide to FLOW3       share
Components


Component with Constructor Injection




                                  Inspiring people to
Hitchhiker's Guide to FLOW3       share
Components


Component with Setter Injection




                                  Inspiring people to
Hitchhiker's Guide to FLOW3       share
Components


Autowiring
      FLOW3's framework tries to autowire constructor arguments and
      arguments of inject* methods

      The type of the component to be injected is determined by the
      argument type (type hinting)

      Autowiring does not work with Setter Injection through regular
      setters (set* methods)

      Dependencies are only autowired if no argument is passed explicitly




                                                                            Inspiring people to
Hitchhiker's Guide to FLOW3                                                 share
Components


Fetching components manually
      Although Dependency Injection is strongly recommended, there
      might be cases in which components need to be created or retrieved
      manually

      Use the getComponent() method in these cases.

      $component = $componentManager->getComponent($componentName, $arg1, $arg2, ...);




                                                                           Inspiring people to
Hitchhiker's Guide to FLOW3                                                share
Components


Component scope
      Component objects always live in a certain scope

      Currently supported scopes are:

         Singleton - Only one instance exists during one script run

         Prototype - Each getComponent() call returns a fresh instance




                                                                         Inspiring people to
Hitchhiker's Guide to FLOW3                                              share
Components


Component scope
      The scope can be defined through

         an annotation in the component class (recommended)

         through the component configuration in a Components.php file

      The default scope is "Singleton"




                                                                      Inspiring people to
Hitchhiker's Guide to FLOW3                                           share
Components


Component scope




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Components


Creating Prototypes
      Dependency Injection can be used in almost any case, there's no
      need to call getComponent()

      But what if you need to instantiate a component within a method?




                                                                         Inspiring people to
Hitchhiker's Guide to FLOW3                                              share
Components


Creating Prototypes
      Solution A: Call getComponent()




                                        Inspiring people to
Hitchhiker's Guide to FLOW3             share
Components


Creating Prototypes
      Solution B: Call a factory method




                                          Inspiring people to
Hitchhiker's Guide to FLOW3               share
Components


Creating Prototypes
      Planned feature: Automatically generated factory methods




                                                                 Inspiring people to
Hitchhiker's Guide to FLOW3                                      share
Caching




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Caching


Caching
          FLOW3 comes with a generic caching mechanism
          Different kinds of cache frontends (aka "Caches") are supported:

             Variable cache: Caches all kinds of variables, including objects
             File cache: Is optimized for caching files
          Various kinds of cache backends (aka "Storages") can be used:

             File backend: Store cache content in files
             Memcached backend: Store cache content in memory

          More frontends and backends are planned

          User-defined frontends and backends can be used as well


                                                                                Inspiring people to
Hitchhiker's Guide to FLOW3                                                     share
Caching


Cache Configuration Example
          The component configuration is cached in Production context
          This is achieved by enabling the cache in the production
          configuration




                                                                       Inspiring people to
Hitchhiker's Guide to FLOW3                                            share
Caching


Cache Files Example




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Caching


How to Cache
          Create a new cache frontend - backend pair

          Configure the frontend as necessary

          Store data using the frontend's API

          Retrieve data using the frontend's API




                                                       Inspiring people to
Hitchhiker's Guide to FLOW3                            share
Caching


How to Cache



                   DEMO
                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
Caching


Cache Manager
          Provides a registry for reusing caches

          Caches are registered through the registerCache() method and can
          be retrieved again by calling the getCache() method

          Caching can be done without the Cache Manager, too. Registration is
          not mandatory and only needed if you want to share the cache
          object among different places




                                                                                Inspiring people to
Hitchhiker's Guide to FLOW3                                                     share
Caching


How Use the Cache Manager



                   DEMO
                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
More ...




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
More ...


Coding Guidelines
           Malte and Tim create the FLOW3CGL package

           CGL document will be on forge.typo3.org soon




                                                          Inspiring people to
Hitchhiker's Guide to FLOW3                               share
More ...


DEV3




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
More ...


AOP Browser




                              Inspiring people to
Hitchhiker's Guide to FLOW3   share
More ...


Known Issues
           FLOW3 (or rather PHP) currently causes
           Apache crashes - why ever ...

           Tests consume a lot of memory
           (> 400 MB)

           Access is comparably slow even in
           Production context (~ 3 req/s) and
           needs much memory (~ 20 MB)

           Many aspects are work in progress and
           neither optimized nor finished



                                                    Inspiring people to
Hitchhiker's Guide to FLOW3                         share
Links
     FLOW3 Website
     http://flow3.typo3.org

     TYPO3 5.0 Subsite
     http://typo3.org/gimmefive

     TYPO3 Forge
     http://forge.typo3.org




                                 Inspiring people to
Hitchhiker's Guide to FLOW3      share
So long and thanks for the fish


Questions




                                 Inspiring people to
Hitchhiker's Guide to FLOW3      share
Hitchhiker’s Guide to FLOW3

More Related Content

Viewers also liked

Media Services Profile of Gopalakrishna (GK) Palem
Media Services Profile of Gopalakrishna (GK) PalemMedia Services Profile of Gopalakrishna (GK) Palem
Media Services Profile of Gopalakrishna (GK) PalemGopalakrishna Palem
 
Personal Learning Environment
Personal Learning EnvironmentPersonal Learning Environment
Personal Learning Environmentmacavech
 
Mary ramirez
Mary ramirezMary ramirez
Mary ramirezmariluzrc
 
ISPO - energYnnovation - Opinioni e atteggiamenti delle famiglie italiane ver...
ISPO - energYnnovation - Opinioni e atteggiamenti delle famiglie italiane ver...ISPO - energYnnovation - Opinioni e atteggiamenti delle famiglie italiane ver...
ISPO - energYnnovation - Opinioni e atteggiamenti delle famiglie italiane ver...ENGIE Italia
 
How-to Drive Business Sponsoring Apps
How-to Drive Business Sponsoring Apps How-to Drive Business Sponsoring Apps
How-to Drive Business Sponsoring Apps Kyle Ransom
 
SOCALGAS® ENERGY-EFFICIENCY PROGRAM PROCESS MAPPING
SOCALGAS® ENERGY-EFFICIENCY PROGRAM PROCESS MAPPINGSOCALGAS® ENERGY-EFFICIENCY PROGRAM PROCESS MAPPING
SOCALGAS® ENERGY-EFFICIENCY PROGRAM PROCESS MAPPINGE Source Companies, LLC
 
Hitchhiker’s Guide to TYPO3 5.0
Hitchhiker’s Guide to TYPO3 5.0Hitchhiker’s Guide to TYPO3 5.0
Hitchhiker’s Guide to TYPO3 5.0Robert Lemke
 
Cotolma concluye construcción de viviendas en getafe
Cotolma concluye construcción de viviendas en getafeCotolma concluye construcción de viviendas en getafe
Cotolma concluye construcción de viviendas en getafeGrupo Cotolma
 
International Open Data Day 2014 Marche by Unicam - Presentazione di Francesc...
International Open Data Day 2014 Marche by Unicam - Presentazione di Francesc...International Open Data Day 2014 Marche by Unicam - Presentazione di Francesc...
International Open Data Day 2014 Marche by Unicam - Presentazione di Francesc...Francesco Ciclosi
 
12 efective listening.pdfx
12 efective listening.pdfx12 efective listening.pdfx
12 efective listening.pdfxSALMAN SHAIKH
 

Viewers also liked (12)

Media Services Profile of Gopalakrishna (GK) Palem
Media Services Profile of Gopalakrishna (GK) PalemMedia Services Profile of Gopalakrishna (GK) Palem
Media Services Profile of Gopalakrishna (GK) Palem
 
Personal Learning Environment
Personal Learning EnvironmentPersonal Learning Environment
Personal Learning Environment
 
Mary ramirez
Mary ramirezMary ramirez
Mary ramirez
 
ISPO - energYnnovation - Opinioni e atteggiamenti delle famiglie italiane ver...
ISPO - energYnnovation - Opinioni e atteggiamenti delle famiglie italiane ver...ISPO - energYnnovation - Opinioni e atteggiamenti delle famiglie italiane ver...
ISPO - energYnnovation - Opinioni e atteggiamenti delle famiglie italiane ver...
 
Europeana Tech 2011
Europeana Tech 2011Europeana Tech 2011
Europeana Tech 2011
 
How-to Drive Business Sponsoring Apps
How-to Drive Business Sponsoring Apps How-to Drive Business Sponsoring Apps
How-to Drive Business Sponsoring Apps
 
SOCALGAS® ENERGY-EFFICIENCY PROGRAM PROCESS MAPPING
SOCALGAS® ENERGY-EFFICIENCY PROGRAM PROCESS MAPPINGSOCALGAS® ENERGY-EFFICIENCY PROGRAM PROCESS MAPPING
SOCALGAS® ENERGY-EFFICIENCY PROGRAM PROCESS MAPPING
 
Crazybulkwomen.com
Crazybulkwomen.comCrazybulkwomen.com
Crazybulkwomen.com
 
Hitchhiker’s Guide to TYPO3 5.0
Hitchhiker’s Guide to TYPO3 5.0Hitchhiker’s Guide to TYPO3 5.0
Hitchhiker’s Guide to TYPO3 5.0
 
Cotolma concluye construcción de viviendas en getafe
Cotolma concluye construcción de viviendas en getafeCotolma concluye construcción de viviendas en getafe
Cotolma concluye construcción de viviendas en getafe
 
International Open Data Day 2014 Marche by Unicam - Presentazione di Francesc...
International Open Data Day 2014 Marche by Unicam - Presentazione di Francesc...International Open Data Day 2014 Marche by Unicam - Presentazione di Francesc...
International Open Data Day 2014 Marche by Unicam - Presentazione di Francesc...
 
12 efective listening.pdfx
12 efective listening.pdfx12 efective listening.pdfx
12 efective listening.pdfx
 

Similar to Hitchhiker’s Guide to FLOW3

Fluent Development with FLOW3
Fluent Development with FLOW3Fluent Development with FLOW3
Fluent Development with FLOW3Robert Lemke
 
Fluent Development with FLOW3
Fluent Development with FLOW3Fluent Development with FLOW3
Fluent Development with FLOW3Robert Lemke
 
T3DD09: Hitchhiker’s Guide to FLOW3
T3DD09: Hitchhiker’s Guide to FLOW3T3DD09: Hitchhiker’s Guide to FLOW3
T3DD09: Hitchhiker’s Guide to FLOW3Robert Lemke
 
Development with TYPO3 5.0
Development with TYPO3 5.0Development with TYPO3 5.0
Development with TYPO3 5.0Robert Lemke
 
T3CON09 Dallas: Hitchhikersguide
T3CON09 Dallas: HitchhikersguideT3CON09 Dallas: Hitchhikersguide
T3CON09 Dallas: HitchhikersguideRobert Lemke
 
2012 08-11-flow3-northeast-php
2012 08-11-flow3-northeast-php2012 08-11-flow3-northeast-php
2012 08-11-flow3-northeast-phpJochen Rau
 
TYPO3 Flow 2.0 in the field - webtech Conference 2013
TYPO3 Flow 2.0 in the field - webtech Conference 2013TYPO3 Flow 2.0 in the field - webtech Conference 2013
TYPO3 Flow 2.0 in the field - webtech Conference 2013die.agilen GmbH
 
IPCSE12: Getting into FLOW3
IPCSE12: Getting into FLOW3IPCSE12: Getting into FLOW3
IPCSE12: Getting into FLOW3Robert Lemke
 
Liferay Configuration and Customization
Liferay Configuration and CustomizationLiferay Configuration and Customization
Liferay Configuration and CustomizationThành Nguyễn
 
Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3William Lee
 
Getting Into FLOW3 (DPC12)
Getting Into FLOW3 (DPC12)Getting Into FLOW3 (DPC12)
Getting Into FLOW3 (DPC12)Robert Lemke
 
FLOW3 Tutorial - T3CON11 Frankfurt
FLOW3 Tutorial - T3CON11 FrankfurtFLOW3 Tutorial - T3CON11 Frankfurt
FLOW3 Tutorial - T3CON11 FrankfurtRobert Lemke
 
FlashInTO SVN Presentation
FlashInTO SVN PresentationFlashInTO SVN Presentation
FlashInTO SVN PresentationMatthew Fabb
 
Implementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPImplementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPKarsten Dambekalns
 
CICON2010: Adam Griffiths - CodeIgniter 2
CICON2010: Adam Griffiths - CodeIgniter 2CICON2010: Adam Griffiths - CodeIgniter 2
CICON2010: Adam Griffiths - CodeIgniter 2CodeIgniter Conference
 

Similar to Hitchhiker’s Guide to FLOW3 (20)

Fluent Development with FLOW3
Fluent Development with FLOW3Fluent Development with FLOW3
Fluent Development with FLOW3
 
Fluent Development with FLOW3
Fluent Development with FLOW3Fluent Development with FLOW3
Fluent Development with FLOW3
 
T3DD09: Hitchhiker’s Guide to FLOW3
T3DD09: Hitchhiker’s Guide to FLOW3T3DD09: Hitchhiker’s Guide to FLOW3
T3DD09: Hitchhiker’s Guide to FLOW3
 
Development with TYPO3 5.0
Development with TYPO3 5.0Development with TYPO3 5.0
Development with TYPO3 5.0
 
Introduction to Flow3
Introduction to Flow3Introduction to Flow3
Introduction to Flow3
 
T3CON09 Dallas: Hitchhikersguide
T3CON09 Dallas: HitchhikersguideT3CON09 Dallas: Hitchhikersguide
T3CON09 Dallas: Hitchhikersguide
 
F3X12 FLOW3 Project Lifecycle
F3X12 FLOW3 Project LifecycleF3X12 FLOW3 Project Lifecycle
F3X12 FLOW3 Project Lifecycle
 
2012 08-11-flow3-northeast-php
2012 08-11-flow3-northeast-php2012 08-11-flow3-northeast-php
2012 08-11-flow3-northeast-php
 
TYPO3 Flow 2.0 in the field - webtech Conference 2013
TYPO3 Flow 2.0 in the field - webtech Conference 2013TYPO3 Flow 2.0 in the field - webtech Conference 2013
TYPO3 Flow 2.0 in the field - webtech Conference 2013
 
IPCSE12: Getting into FLOW3
IPCSE12: Getting into FLOW3IPCSE12: Getting into FLOW3
IPCSE12: Getting into FLOW3
 
Schulung Fluid Templating
Schulung Fluid TemplatingSchulung Fluid Templating
Schulung Fluid Templating
 
Liferay Configuration and Customization
Liferay Configuration and CustomizationLiferay Configuration and Customization
Liferay Configuration and Customization
 
Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3
 
Getting Into FLOW3 (DPC12)
Getting Into FLOW3 (DPC12)Getting Into FLOW3 (DPC12)
Getting Into FLOW3 (DPC12)
 
FLOW3 Tutorial - T3CON11 Frankfurt
FLOW3 Tutorial - T3CON11 FrankfurtFLOW3 Tutorial - T3CON11 Frankfurt
FLOW3 Tutorial - T3CON11 Frankfurt
 
FlashInTO SVN Presentation
FlashInTO SVN PresentationFlashInTO SVN Presentation
FlashInTO SVN Presentation
 
Laravel 5.3 - Web Development Php framework
Laravel 5.3 - Web Development Php frameworkLaravel 5.3 - Web Development Php framework
Laravel 5.3 - Web Development Php framework
 
Maven
MavenMaven
Maven
 
Implementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPImplementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHP
 
CICON2010: Adam Griffiths - CodeIgniter 2
CICON2010: Adam Griffiths - CodeIgniter 2CICON2010: Adam Griffiths - CodeIgniter 2
CICON2010: Adam Griffiths - CodeIgniter 2
 

More from Robert Lemke

Neos Content Repository – Git for content
Neos Content Repository – Git for contentNeos Content Repository – Git for content
Neos Content Repository – Git for contentRobert Lemke
 
A General Purpose Docker Image for PHP
A General Purpose Docker Image for PHPA General Purpose Docker Image for PHP
A General Purpose Docker Image for PHPRobert Lemke
 
Scaleable PHP Applications in Kubernetes
Scaleable PHP Applications in KubernetesScaleable PHP Applications in Kubernetes
Scaleable PHP Applications in KubernetesRobert Lemke
 
Flownative Beach - Neos Meetup Hamburg 2022
Flownative Beach - Neos Meetup Hamburg 2022Flownative Beach - Neos Meetup Hamburg 2022
Flownative Beach - Neos Meetup Hamburg 2022Robert Lemke
 
GitOps with Flux - IPC Munich 2022
GitOps with Flux - IPC Munich 2022GitOps with Flux - IPC Munich 2022
GitOps with Flux - IPC Munich 2022Robert Lemke
 
OpenID Connect with Neos and Flow
OpenID Connect with Neos and FlowOpenID Connect with Neos and Flow
OpenID Connect with Neos and FlowRobert Lemke
 
Neos Conference 2019 Keynote
Neos Conference 2019 KeynoteNeos Conference 2019 Keynote
Neos Conference 2019 KeynoteRobert Lemke
 
A practical introduction to Kubernetes (IPC 2018)
A practical introduction to Kubernetes (IPC 2018)A practical introduction to Kubernetes (IPC 2018)
A practical introduction to Kubernetes (IPC 2018)Robert Lemke
 
Neos Conference 2018 Welcome Keynote
Neos Conference 2018 Welcome KeynoteNeos Conference 2018 Welcome Keynote
Neos Conference 2018 Welcome KeynoteRobert Lemke
 
A practical introduction to Event Sourcing and CQRS
A practical introduction to Event Sourcing and CQRSA practical introduction to Event Sourcing and CQRS
A practical introduction to Event Sourcing and CQRSRobert Lemke
 
Neos Conference 2017 Welcome Keynote
Neos Conference 2017 Welcome KeynoteNeos Conference 2017 Welcome Keynote
Neos Conference 2017 Welcome KeynoteRobert Lemke
 
IPC16: A Practical Introduction to Kubernetes
IPC16: A Practical Introduction to Kubernetes IPC16: A Practical Introduction to Kubernetes
IPC16: A Practical Introduction to Kubernetes Robert Lemke
 
IPC 2016: Content Strategy for Developers
IPC 2016: Content Strategy for DevelopersIPC 2016: Content Strategy for Developers
IPC 2016: Content Strategy for DevelopersRobert Lemke
 
Docker in Production - IPC 2016
Docker in Production - IPC 2016Docker in Production - IPC 2016
Docker in Production - IPC 2016Robert Lemke
 
Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)
Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)
Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)Robert Lemke
 
The Neos Brand (Inspiring Conference 2016)
The Neos Brand (Inspiring Conference 2016)The Neos Brand (Inspiring Conference 2016)
The Neos Brand (Inspiring Conference 2016)Robert Lemke
 
Neos - past, present, future (Inspiring Conference 2016)
Neos - past, present, future (Inspiring Conference 2016)Neos - past, present, future (Inspiring Conference 2016)
Neos - past, present, future (Inspiring Conference 2016)Robert Lemke
 
Meet Neos Nürnberg 2016: Ja ich will!
Meet Neos Nürnberg 2016: Ja ich will!Meet Neos Nürnberg 2016: Ja ich will!
Meet Neos Nürnberg 2016: Ja ich will!Robert Lemke
 
Meet Neos Nürnberg 2016: Hallo Neos!
Meet Neos Nürnberg 2016: Hallo Neos!Meet Neos Nürnberg 2016: Hallo Neos!
Meet Neos Nürnberg 2016: Hallo Neos!Robert Lemke
 
Turning Neos inside out / React.js HH
Turning Neos inside out / React.js HHTurning Neos inside out / React.js HH
Turning Neos inside out / React.js HHRobert Lemke
 

More from Robert Lemke (20)

Neos Content Repository – Git for content
Neos Content Repository – Git for contentNeos Content Repository – Git for content
Neos Content Repository – Git for content
 
A General Purpose Docker Image for PHP
A General Purpose Docker Image for PHPA General Purpose Docker Image for PHP
A General Purpose Docker Image for PHP
 
Scaleable PHP Applications in Kubernetes
Scaleable PHP Applications in KubernetesScaleable PHP Applications in Kubernetes
Scaleable PHP Applications in Kubernetes
 
Flownative Beach - Neos Meetup Hamburg 2022
Flownative Beach - Neos Meetup Hamburg 2022Flownative Beach - Neos Meetup Hamburg 2022
Flownative Beach - Neos Meetup Hamburg 2022
 
GitOps with Flux - IPC Munich 2022
GitOps with Flux - IPC Munich 2022GitOps with Flux - IPC Munich 2022
GitOps with Flux - IPC Munich 2022
 
OpenID Connect with Neos and Flow
OpenID Connect with Neos and FlowOpenID Connect with Neos and Flow
OpenID Connect with Neos and Flow
 
Neos Conference 2019 Keynote
Neos Conference 2019 KeynoteNeos Conference 2019 Keynote
Neos Conference 2019 Keynote
 
A practical introduction to Kubernetes (IPC 2018)
A practical introduction to Kubernetes (IPC 2018)A practical introduction to Kubernetes (IPC 2018)
A practical introduction to Kubernetes (IPC 2018)
 
Neos Conference 2018 Welcome Keynote
Neos Conference 2018 Welcome KeynoteNeos Conference 2018 Welcome Keynote
Neos Conference 2018 Welcome Keynote
 
A practical introduction to Event Sourcing and CQRS
A practical introduction to Event Sourcing and CQRSA practical introduction to Event Sourcing and CQRS
A practical introduction to Event Sourcing and CQRS
 
Neos Conference 2017 Welcome Keynote
Neos Conference 2017 Welcome KeynoteNeos Conference 2017 Welcome Keynote
Neos Conference 2017 Welcome Keynote
 
IPC16: A Practical Introduction to Kubernetes
IPC16: A Practical Introduction to Kubernetes IPC16: A Practical Introduction to Kubernetes
IPC16: A Practical Introduction to Kubernetes
 
IPC 2016: Content Strategy for Developers
IPC 2016: Content Strategy for DevelopersIPC 2016: Content Strategy for Developers
IPC 2016: Content Strategy for Developers
 
Docker in Production - IPC 2016
Docker in Production - IPC 2016Docker in Production - IPC 2016
Docker in Production - IPC 2016
 
Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)
Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)
Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)
 
The Neos Brand (Inspiring Conference 2016)
The Neos Brand (Inspiring Conference 2016)The Neos Brand (Inspiring Conference 2016)
The Neos Brand (Inspiring Conference 2016)
 
Neos - past, present, future (Inspiring Conference 2016)
Neos - past, present, future (Inspiring Conference 2016)Neos - past, present, future (Inspiring Conference 2016)
Neos - past, present, future (Inspiring Conference 2016)
 
Meet Neos Nürnberg 2016: Ja ich will!
Meet Neos Nürnberg 2016: Ja ich will!Meet Neos Nürnberg 2016: Ja ich will!
Meet Neos Nürnberg 2016: Ja ich will!
 
Meet Neos Nürnberg 2016: Hallo Neos!
Meet Neos Nürnberg 2016: Hallo Neos!Meet Neos Nürnberg 2016: Hallo Neos!
Meet Neos Nürnberg 2016: Hallo Neos!
 
Turning Neos inside out / React.js HH
Turning Neos inside out / React.js HHTurning Neos inside out / React.js HH
Turning Neos inside out / React.js HH
 

Hitchhiker’s Guide to FLOW3

  • 2. Overview Hello FLOW3! Configuration Bootstrap Packages Components Caching More Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 3. Getting Started Hello FLOW3! The Hello World example based on FLOW3's Model-View-Controller Framework. Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 4. Getting Started 5 Easy Steps 1. Download FLOW3 2. Adjust write permissions 3. Create a new package 4. Create a default controller 5. Create a default action Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 5. Getting Started 1. Download FLOW3 Just checkout the FLOW3 distribution via Subversion: svn co http://svn.typo3.org/FLOW3/dist/trunk/ Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 6. Getting Started 2. Adjust write permissions Make sure that the public folder is writeable for the webserver's user: sudo chown -R robert:www public/ sudo chmod -R 770 public/ Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 7. Getting Started 3. Create a package In order to create a new package, just create a new folder within the Packages directory. Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 8. Getting Started 4. Create a Default Controller 1. Create a "Classes" directory 2. Create a "Controller" directory 3. Create a class file 4. Extend FLOW3's action controller Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 9. Getting Started 5. Create Default Action Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 10. Configuration Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 11. Configuration Configuration Format The default configuration format is PHP Configuration options reside in a configuration object The configuration object provides array access and a fluent interface Configuration options are self-documenting Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 12. Configuration Configuration Format Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 13. Configuration Configuration Types FLOW3 distinguishes between different configuration types for different purposes: FLOW3 - reserved for FLOW3 configuration Package - package related configuration Component - configuration for components, including Dependency Injection Routes - special configuration for defining MVC routes Settings - mainly user-level settings for any purpose Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 14. Configuration Configuration Types Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 15. Configuration The Cascade Each package defines possible configuration options by setting default values Default configuration can be altered by user-defined configuration files User configuration can only modify existing configuration options Modifying non-existent configuration options results in an error Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 16. Configuration Application Context An application context is a set of configuration for a specific context FLOW3 is shipped with configuration for these contexts: Production Development Testing Staging FLOW3 is always launched in one defined context Additional, user-defined contexts are possible Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 17. Configuration Application Context Configuration defined in the top level of a Configuration directory is the base configuration Specialized configuration for application contexts reside in subdirectories named after the context Application context configuration overrides the base configuration Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 18. Configuration Application Context Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 19. Bootstrap (or: how to launch a rocket) Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 20. Bootstrap Public/index.php This file is the default main script It launches FLOW3 in the Production context The webserver's web root should point to the Public directory Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 21. Bootstrap Public/index_dev.php This script is used for development It launches FLOW3 in the Development context More scripts like this can be created for additional contexts Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 22. Bootstrap Public/index_dev.php Don't forget to run FLOW3 in Development context while you're developing because component configuration is cached in production mode, so new classes won't be recognized resources are cached in production mode, so changes won't be detected and many more things might be cached which lead to unexpected errors if you change some code in your package Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 23. Bootstrap $FLOW3->run() run() is a convenience method which initializes the FLOW3 framework resolves a request handler handles and responses to the request Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 24. Bootstrap $FLOW3->initialize() The initialization process is divided into different stages: Initialize FLOW3 Initialize the packages Initialize the components Initialize the settings Initialize the resources The configuration for each level can't be changed once the initialization level is reached Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 25. Packages Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 26. Packages Package Manager Like the good old Extension Manager - but without UI yet Scans the Packages directory for packages Will connect to the FLOW3 Package Repository Package file format is just plain .zip Will provide access via Web / CLI and offer Web Services Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 27. Packages Meta/Package.xml Contains meta information about a FLOW3 package The format is defined by a RelaxNG schema: http://typo3.org/ns/2008/flow3/package/Package.rng The Package.xml will soon be mandatory Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 28. Components Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 29. Components Components Components are re-usable, properly encapsulated objects The lifecycle of a component and the combination of active components is managed by the Component Manager All classes in the TYPO3 context are considered as components Components are configurable Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 30. Components Class ≙ Component Classes are automatically registered as components if they reside in the Classes directory of a package and their name follows the FLOW3 naming conventions Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 31. Components Example Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 32. Components Playing with building blocks The combination of components used is configurable (orchestration) The less components know about each other the easier it is to reuse them in a variety of contexts Create your own LEGO set by creating cleanly separated, decoupled components! Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 33. Components Component Dependencies Components seldomly come alone Components depend on other components which depend on other components which ... Problem: Components explicitly refer to other components: $phoneBookManager = new PhoneBookManager Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 34. Components Dependency Injection A component doesn't ask for the instance of another component but gets it injected This methodology is referred to as the "Hollywood Principle": "Don't call us, we'll call you" Enforces loose coupling and high cohesion Makes you a better programmer Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 35. Components Constructor without Dependency Injection Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 36. Components Component with Constructor Injection Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 37. Components Component with Setter Injection Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 38. Components Autowiring FLOW3's framework tries to autowire constructor arguments and arguments of inject* methods The type of the component to be injected is determined by the argument type (type hinting) Autowiring does not work with Setter Injection through regular setters (set* methods) Dependencies are only autowired if no argument is passed explicitly Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 39. Components Fetching components manually Although Dependency Injection is strongly recommended, there might be cases in which components need to be created or retrieved manually Use the getComponent() method in these cases. $component = $componentManager->getComponent($componentName, $arg1, $arg2, ...); Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 40. Components Component scope Component objects always live in a certain scope Currently supported scopes are: Singleton - Only one instance exists during one script run Prototype - Each getComponent() call returns a fresh instance Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 41. Components Component scope The scope can be defined through an annotation in the component class (recommended) through the component configuration in a Components.php file The default scope is "Singleton" Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 42. Components Component scope Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 43. Components Creating Prototypes Dependency Injection can be used in almost any case, there's no need to call getComponent() But what if you need to instantiate a component within a method? Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 44. Components Creating Prototypes Solution A: Call getComponent() Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 45. Components Creating Prototypes Solution B: Call a factory method Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 46. Components Creating Prototypes Planned feature: Automatically generated factory methods Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 47. Caching Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 48. Caching Caching FLOW3 comes with a generic caching mechanism Different kinds of cache frontends (aka "Caches") are supported: Variable cache: Caches all kinds of variables, including objects File cache: Is optimized for caching files Various kinds of cache backends (aka "Storages") can be used: File backend: Store cache content in files Memcached backend: Store cache content in memory More frontends and backends are planned User-defined frontends and backends can be used as well Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 49. Caching Cache Configuration Example The component configuration is cached in Production context This is achieved by enabling the cache in the production configuration Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 50. Caching Cache Files Example Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 51. Caching How to Cache Create a new cache frontend - backend pair Configure the frontend as necessary Store data using the frontend's API Retrieve data using the frontend's API Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 52. Caching How to Cache DEMO Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 53. Caching Cache Manager Provides a registry for reusing caches Caches are registered through the registerCache() method and can be retrieved again by calling the getCache() method Caching can be done without the Cache Manager, too. Registration is not mandatory and only needed if you want to share the cache object among different places Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 54. Caching How Use the Cache Manager DEMO Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 55. More ... Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 56. More ... Coding Guidelines Malte and Tim create the FLOW3CGL package CGL document will be on forge.typo3.org soon Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 57. More ... DEV3 Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 58. More ... AOP Browser Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 59. More ... Known Issues FLOW3 (or rather PHP) currently causes Apache crashes - why ever ... Tests consume a lot of memory (> 400 MB) Access is comparably slow even in Production context (~ 3 req/s) and needs much memory (~ 20 MB) Many aspects are work in progress and neither optimized nor finished Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 60. Links FLOW3 Website http://flow3.typo3.org TYPO3 5.0 Subsite http://typo3.org/gimmefive TYPO3 Forge http://forge.typo3.org Inspiring people to Hitchhiker's Guide to FLOW3 share
  • 61. So long and thanks for the fish Questions Inspiring people to Hitchhiker's Guide to FLOW3 share