SlideShare a Scribd company logo
International PHP Conference 2008   Inspiring people to
Fluent Development with FLOW3       share
The History of FLOW3
      (short version)
The Long History of TYPO3
 Since 1998

 33 core members

 committed 500.000 lines of code

 resulting in a code base of

 300.000 lines today
TYPO3 today
     TYPO3 v4 is nearly feature complete

     Grown architecture, few unit tests

     Fundamental changes are risky

     Often used as an application framework - but was designed as a CMS




Fluent Development with FLOW3                                   Inspiring people to
                                                                share
TYPO3 tomorrow?




Fluent Development with FLOW3   Inspiring people to
                                share
<?php
Buy none get two for free.




Fluent Development with FLOW3   Inspiring people to
                                share
TYPO3 tomorrow
     FLOW3 acts as a reliable basis for any kind of web application

     TYPO3 v5 is a package based on FLOW3

     Extensions are packages as well, all based on FLOW3


     Packages can be used

       as extensions for TYPO3

       as libraries for standalone applications


Fluent Development with FLOW3                                         Inspiring people to
                                                                      share
The FLOW3 experience
 Flow [fl!] The mental state of operation in which the person is fully immersed in
 what he or she is doing by a feeling of energized focus, full involvement, and
 success in the process of the activity. Proposed by positive psychologist Mihály
 Csíkszentmihályi, the concept has been widely referenced across a variety of fields.

 FLOW3 [fl!'three] The application framework which takes care of all hassle and lets
 you play the fun part.




Fluent Development with FLOW3                                      Inspiring people to
                                                                   share
!   /**
!     * Creates a customer
!     *
!     * @return void
!     */
!   public function createAction() {
!   !     if (!$this->authorizationService->getCurrentUser()->hasRole('Admin')) {
!   !     !     $this->logger->log('Someone tried to create a new customer.');
!   !     !     throw new AccessDeniedException('You may not create customers.');
!   !     }
!   !     if ($this->request->getProtocol != 'HTTPS') {
!   !     !     $this->logger->log('Someone tried to create a new customer not using HTTPS.');
!   !     !     throw new SecurityException('Customers may only be created via HTTPS');
!   !     }
!   !
!   !     if (strlen($_POST['firstname']) > 50) throw new InvalidArgumentException();
!   !
!   !     $customer = new ModelCustomer;
!   !     $customer->setFirstName($_POST['firstname']);
!   !     $customer->setLastName($_POST['lastname']);
!   !
!   !     $customerValidator = MyAppValidatorsCustomerValidator::getInstance();
!   !     if ($customerValidator->validate($customer)) {
!   !     !     $customer->save();
!   !     !     $this->logger->log('A new customer was saved');
!   !     } else {
!   !     !     throw new InvalidCustomerException();
!   !     }
!   }




      Fluent Development with FLOW3                                                              Inspiring people to
                                                                                                 share
!   /**
!     * Creates a customer
!     *
!     * @return void
!     */
!   public function createAction() {
!   !     if (!$this->authorizationService->getCurrentUser()->hasRole('Admin')) {
!   !     !     $this->logger->log('Someone tried to create a new customer.');
!   !     !     throw new AccessDeniedException('You may not create customers.');
!   !     }
!   !     if ($this->request->getProtocol != 'HTTPS') {
!   !     !     $this->logger->log('Someone tried to create a new customer not using HTTPS.');
!   !     !     throw new SecurityException('Customers may only be created via HTTPS');
!   !     }
!   !
!   !     if (strlen($_POST['firstname']) > 50) throw new InvalidArgumentException();
!   !
!   !     $customer = new ModelCustomer;
!   !     $customer->setFirstName($_POST['firstname']);
!   !     $customer->setLastName($_POST['lastname']);
!   !
!   !     $customerValidator = MyAppValidatorsCustomerValidator::getInstance();
!   !     if ($customerValidator->validate($customer)) {
!   !     !     $customer->save();
!   !     !     $this->logger->log('A new customer was saved');
!   !     } else {
!   !     !     throw new InvalidCustomerException();
!   !     }
!   }




      Fluent Development with FLOW3                                                              Inspiring people to
                                                                                                 share
<?php

!       /**
!         * Creates a customer
!         *
!         * @return void
!         */
!       public function createAction() {
!       !     if ($this->arguments->hasErrors()) $this->throwStatus(400, 'Bad Request', '<strong>Invalid arguments!</strong>');

!       !    $customer = new DomainModelCustomer();
!       !    $this->dataMapper->map($this->arguments['customer'], $customer);
!       !    $this->customerRepository->add($customer);

!       !    $this->throwStatus(201);
!       }

?>




            Fluent Development with FLOW3                                                                  Inspiring people to
                                                                                                           share
FLOW3 = Application Framework
     Not just a collection of components or code snippet library

     Comes with ready-to-go default configuration

     Package based
                       PHP 5
     Runs with PHP 5.3 or later.3alpha
                                        1
     Comes with a powerful JSR-283 based Content Repository




Fluent Development with FLOW3                                      Inspiring people to
                                                                   share
Finest Handmade PHP Code
     100% documented source code (top project at Ohloh)

     Consistent and intuitive class, method and variable names

     FLOW3 Core Team always develops test-driven

     Continuous Integration

       multiple commits each day

       automatic tests for Linux, Windows and Mac with SQLite, MySQL and Postgres

       open CI server with statistics, email and jabber notifications


Fluent Development with FLOW3                                      Inspiring people to
                                                                   share
FLOW3 modules
     AOP                Locale        Reflection

     Component          Log           Resource

     Configuration       MVC           Security

     Cache              Package       Utility

     Error              Persistence   Validation

     Event              Property      ... and more



Fluent Development with FLOW3                   Inspiring people to
                                                share
Getting Started




Fluent Development with FLOW3   Inspiring people to
                                share
Getting Started


Requirements
       Some webserver (tested with Apache and IIS)

       PHP 5.3alpha1 or higher (see http://snaps.php.net/)

          PHP extensions: zlib, PDO and PDO SQLite and the usual stuff

       Some database (tested with SQLite, MySQL and Postgres)




Fluent Development with FLOW3                                        Inspiring people to
                                                                     share
Getting Started


Download
       Currently available through Subversion

          Checkout the FLOW3 Distribution:
          svn co https://svn.typo3.org/FLOW3/distribution/trunk

          or try the TYPO3 Distribution:
          svn co https://svn.typo3.org/TYPO3v5/distribution/trunk

       Nightly builds will follow after the 1.0 alpha 1 release




Fluent Development with FLOW3                                     Inspiring people to
                                                                  share
Fluent Development with FLOW3   Inspiring people to
                                share
Getting Started


Grant File Permissions
       The webserver needs

          read access for all files of the distribution and

          write access in the Public and Data directory

       On Linux / Mac just call sudo ./fixpermissions.sh

       On legacy operating systems: ask your system administrator




Fluent Development with FLOW3                                       Inspiring people to
                                                                    share
Getting Started


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




Fluent Development with FLOW3                   Inspiring people to
                                                share
Getting Started


     Create a Default Controller
         Create a subfolder in your package: Classes/Controller/

         Create the controller class file:



<?php
declare(ENCODING = 'utf-8');
namespace F3MyPackageController;

class DefaultController extends F3FLOW3MVCControllerActionController {

!     public function indexAction() {
!     !    return 'Hello World!';
!     }
}

?>


     Fluent Development with FLOW3                                           Inspiring people to
                                                                             share
Bootstrap




Fluent Development with FLOW3   Inspiring people to
                                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


  define('FLOW3_PATH_PUBLIC', str_replace('', '/', __DIR__) . '/');
  require(FLOW3_PATH_PUBLIC . '../Packages/FLOW3/Classes/F3_FLOW3.php');

  $framework = new F3FLOW3();
  $framework->run();




Fluent Development with FLOW3                                              Inspiring people to
                                                                           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


  define('FLOW3_PATH_PUBLIC', str_replace('', '/', __DIR__) . '/');
  require(FLOW3_PATH_PUBLIC . '../Packages/FLOW3/Classes/F3_FLOW3.php');

  $framework = new F3FLOW3('Development');
  $framework->run();




Fluent Development with FLOW3                                              Inspiring people to
                                                                           share
Model - View - Controller




Fluent Development with FLOW3   Inspiring people to
                                share
MVC


Key Features
      Powerful Request-Response mechanism, based on Front Controller and
      Dispatcher

      Very convenient controllers and views

      Supports multiple template engines

      Sophisticated, easy to configure routing

      Built-in validation and default security

      REST support


Fluent Development with FLOW3                                   Inspiring people to
                                                               share
MVC


Model Types
                  Active Record                               Domain Model

             Model of / wrapper for a              Model of a domain which consists of
               database table row                          data and behaviour

           is responsible for persistence             doesn't know about persistence

  mixes infrastructure concerns with model           doesn't know about infrastructure

      quick to implement without a framework   clean and easy to use if framework supports it



Fluent Development with FLOW3                                            Inspiring people to
                                                                         share
MVC Pattern


Model
                   Active Record                             Domain Model

              Model of / wrapper for a            Model of a domain which consists of
                database table row                        data and behaviour

         is responsible for persistence              doesn't know about persistence

   mixes infrastructure concerns with model         doesn't know about infrastructure

   quick to implement without a framework     clean and easy to use if framework supports it



Fluent Development with FLOW3                                           Inspiring people to
                                                                        share
MVC Pattern


Model
                   Active Record                             Domain Model

              Model of / wrapper for a            Model of a domain which consists of
                database table row                        data and behaviour

         is responsible for persistence              doesn't know about persistence

   mixes infrastructure concerns with model         doesn't know about infrastructure

   quick to implement without a framework     clean and easy to use if framework supports it



Fluent Development with FLOW3                                           Inspiring people to
                                                                        share
Persistence




Fluent Development with FLOW3   Inspiring people to
                                share
Persistence


JSR-283 based Content Repository
       Defines a uniform API for accessing content repositories

       A Content Repository

          is a kind of object database for storage, search and retrieval of hierarchical
          data

          provides methods for versioning, transactions and monitoring

       TYPO3CR is the first working port of JSR-170 / JSR-283

       Karsten Dambekalns is member of the JSR-283 expert group


Fluent Development with FLOW3                                          Inspiring people to
                                                                       share
Persistence


Transparent Persistence
       Explicit support for Domain-Driven Design

       Class Schemata are defined by the Domain Model class

          No need to write an XML or YAML schema definition

          No need to define the database model and object model multiple
          times at different places

       Automatic persistence in the JSR-283 based Content Repository

       Legacy data sources can be mounted


Fluent Development with FLOW3                                      Inspiring people to
                                                                   share
Components




Fluent Development with FLOW3   Inspiring people to
                                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




Fluent Development with FLOW3                                 Inspiring people to
                                                              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




Fluent Development with FLOW3                                         Inspiring people to
                                                                      share
Components


Autowiring
      FLOW3 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



Fluent Development with FLOW3                                     Inspiring people to
                                                                  share
DEMO

Fluent Development with FLOW3   Inspiring people to
                                share
Security




Fluent Development with FLOW3   Inspiring people to
                                share
Playground




Fluent Development with FLOW3   Inspiring people to
                                share
Things to play with


F3BLOG
       Try out the Blog Example:
       svn co https://svn.typo3.org/FLOW3/Distribution/branches/BlogExample/




Fluent Development with FLOW3                            Inspiring people to
                                                         share
Things to play with


TYPO3CR Admin
       Play with persistence and watch your object in the TYPO3CR Admin




Fluent Development with FLOW3                                      Inspiring people to
                                                                  share
Things to play with


Testrunner
       Experiment with Test-Driven Development and watch the tests in
       FLOW3's test runner




Fluent Development with FLOW3                                     Inspiring people to
                                                                  share
Progress

             Developing FLOW3 ...




Fluent Development with FLOW3       Inspiring people to
                                    share
Next Steps
     First FLOW3 alpha release end of this year

     First pilot projects based on FLOW3 in spring '09

     Further development of the TYPO3 package

     Planned release of TYPO3 5.0 alpha: end of 2009




Fluent Development with FLOW3                            Inspiring people to
                                                         share
Links
     These Slides
     http://flow3.typo3.org/documentation/slides/

     FLOW3 Website
     http://flow3.typo3.org

     TYPO3 Forge
     http://forge.typo3.org

     Further Reading
     http://flow3.typo3.org/about/principles/further-reading/



Fluent Development with FLOW3                                  Inspiring people to
                                                               share
Questions




Fluent Development with FLOW3   Inspiring people to
                                share
Fluent Development with FLOW3

More Related Content

PPTX
Take Command of WordPress With WP-CLI
DOCX
Web-servers & Application Hacking
PDF
Flask - Backend com Python - Semcomp 18
PPTX
Take Command of WordPress With WP-CLI
PPTX
Flask – Python
PPTX
Take Command of WordPress With WP-CLI at WordCamp Long Beach
PDF
Flask patterns
PDF
Web develop in flask
Take Command of WordPress With WP-CLI
Web-servers & Application Hacking
Flask - Backend com Python - Semcomp 18
Take Command of WordPress With WP-CLI
Flask – Python
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Flask patterns
Web develop in flask

What's hot (20)

PDF
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
PDF
Web development automatisation for fun and profit (Artem Daniliants)
PDF
Intro to WordPress Plugin Development
PDF
Python RESTful webservices with Python: Flask and Django solutions
PPT
Now That's What I Call WordPress Security 2010
PDF
BUILDING MODERN PYTHON WEB FRAMEWORKS USING FLASK WITH NEIL GREY
PDF
Symfony: Your Next Microframework (SymfonyCon 2015)
PPTX
Flask restfulservices
PDF
How to Submit a plugin to WordPress.org Repository
PDF
MVC for TYPO3 4.3 with extbase
PDF
Getting root with benign app store apps
PDF
Introduction to PowerShell
PDF
Rest API using Flask & SqlAlchemy
PDF
End to end web security
PDF
Windows Attacks AT is the new black
PDF
TYPO3 Extension development using new Extbase framework
PPTX
Session: WP Site Management using WP-CLI from Scratch
ODP
REST API Laravel
PDF
DrupalCamp London 2017 - Web site insecurity
PDF
GateKeeper - bypass or not bypass?
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
Web development automatisation for fun and profit (Artem Daniliants)
Intro to WordPress Plugin Development
Python RESTful webservices with Python: Flask and Django solutions
Now That's What I Call WordPress Security 2010
BUILDING MODERN PYTHON WEB FRAMEWORKS USING FLASK WITH NEIL GREY
Symfony: Your Next Microframework (SymfonyCon 2015)
Flask restfulservices
How to Submit a plugin to WordPress.org Repository
MVC for TYPO3 4.3 with extbase
Getting root with benign app store apps
Introduction to PowerShell
Rest API using Flask & SqlAlchemy
End to end web security
Windows Attacks AT is the new black
TYPO3 Extension development using new Extbase framework
Session: WP Site Management using WP-CLI from Scratch
REST API Laravel
DrupalCamp London 2017 - Web site insecurity
GateKeeper - bypass or not bypass?
Ad

Similar to Fluent Development with FLOW3 (20)

PDF
FLOW3 Tutorial - T3CON11 Frankfurt
PDF
Fluent Development with FLOW3 1.0
PDF
Fluent Development with FLOW3
PDF
IPCSE12: Getting into FLOW3
PDF
T3DD09: Hitchhiker&rsquo;s Guide to FLOW3
PDF
Getting Into FLOW3 (DPC12)
PDF
Fluent Development with FLOW3 1.0
PDF
IPCSE12: Hands on FLOW3
PDF
Hands on FLOW3 (DPC12)
PDF
2012 08-11-flow3-northeast-php
PDF
Creating Clean Code with AOP (WebExpo 2010)
PDF
Introduction to Flow3
PDF
Applications for the Enterprise with PHP (CPEurope)
PDF
Web application development with laravel php framework version 4
PDF
IRJET- Lightweight MVC Framework in PHP
PPTX
Software Development with PHP & Laravel
PDF
TYPO3 Flow 2.0 (International PHP Conference 2013)
PDF
Getting Into FLOW3 (TYPO312CA)
PDF
Hitchhiker’s Guide to FLOW3
PDF
TYPO3 Flow 2.0 Workshop T3BOARD13
FLOW3 Tutorial - T3CON11 Frankfurt
Fluent Development with FLOW3 1.0
Fluent Development with FLOW3
IPCSE12: Getting into FLOW3
T3DD09: Hitchhiker&rsquo;s Guide to FLOW3
Getting Into FLOW3 (DPC12)
Fluent Development with FLOW3 1.0
IPCSE12: Hands on FLOW3
Hands on FLOW3 (DPC12)
2012 08-11-flow3-northeast-php
Creating Clean Code with AOP (WebExpo 2010)
Introduction to Flow3
Applications for the Enterprise with PHP (CPEurope)
Web application development with laravel php framework version 4
IRJET- Lightweight MVC Framework in PHP
Software Development with PHP & Laravel
TYPO3 Flow 2.0 (International PHP Conference 2013)
Getting Into FLOW3 (TYPO312CA)
Hitchhiker’s Guide to FLOW3
TYPO3 Flow 2.0 Workshop T3BOARD13
Ad

More from Robert Lemke (20)

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

Fluent Development with FLOW3

  • 1. International PHP Conference 2008 Inspiring people to Fluent Development with FLOW3 share
  • 2. The History of FLOW3 (short version)
  • 3. The Long History of TYPO3 Since 1998 33 core members committed 500.000 lines of code resulting in a code base of 300.000 lines today
  • 4. TYPO3 today TYPO3 v4 is nearly feature complete Grown architecture, few unit tests Fundamental changes are risky Often used as an application framework - but was designed as a CMS Fluent Development with FLOW3 Inspiring people to share
  • 5. TYPO3 tomorrow? Fluent Development with FLOW3 Inspiring people to share
  • 7. Buy none get two for free. Fluent Development with FLOW3 Inspiring people to share
  • 8. TYPO3 tomorrow FLOW3 acts as a reliable basis for any kind of web application TYPO3 v5 is a package based on FLOW3 Extensions are packages as well, all based on FLOW3 Packages can be used as extensions for TYPO3 as libraries for standalone applications Fluent Development with FLOW3 Inspiring people to share
  • 9. The FLOW3 experience Flow [fl!] The mental state of operation in which the person is fully immersed in what he or she is doing by a feeling of energized focus, full involvement, and success in the process of the activity. Proposed by positive psychologist Mihály Csíkszentmihályi, the concept has been widely referenced across a variety of fields. FLOW3 [fl!'three] The application framework which takes care of all hassle and lets you play the fun part. Fluent Development with FLOW3 Inspiring people to share
  • 10. ! /** ! * Creates a customer ! * ! * @return void ! */ ! public function createAction() { ! ! if (!$this->authorizationService->getCurrentUser()->hasRole('Admin')) { ! ! ! $this->logger->log('Someone tried to create a new customer.'); ! ! ! throw new AccessDeniedException('You may not create customers.'); ! ! } ! ! if ($this->request->getProtocol != 'HTTPS') { ! ! ! $this->logger->log('Someone tried to create a new customer not using HTTPS.'); ! ! ! throw new SecurityException('Customers may only be created via HTTPS'); ! ! } ! ! ! ! if (strlen($_POST['firstname']) > 50) throw new InvalidArgumentException(); ! ! ! ! $customer = new ModelCustomer; ! ! $customer->setFirstName($_POST['firstname']); ! ! $customer->setLastName($_POST['lastname']); ! ! ! ! $customerValidator = MyAppValidatorsCustomerValidator::getInstance(); ! ! if ($customerValidator->validate($customer)) { ! ! ! $customer->save(); ! ! ! $this->logger->log('A new customer was saved'); ! ! } else { ! ! ! throw new InvalidCustomerException(); ! ! } ! } Fluent Development with FLOW3 Inspiring people to share
  • 11. ! /** ! * Creates a customer ! * ! * @return void ! */ ! public function createAction() { ! ! if (!$this->authorizationService->getCurrentUser()->hasRole('Admin')) { ! ! ! $this->logger->log('Someone tried to create a new customer.'); ! ! ! throw new AccessDeniedException('You may not create customers.'); ! ! } ! ! if ($this->request->getProtocol != 'HTTPS') { ! ! ! $this->logger->log('Someone tried to create a new customer not using HTTPS.'); ! ! ! throw new SecurityException('Customers may only be created via HTTPS'); ! ! } ! ! ! ! if (strlen($_POST['firstname']) > 50) throw new InvalidArgumentException(); ! ! ! ! $customer = new ModelCustomer; ! ! $customer->setFirstName($_POST['firstname']); ! ! $customer->setLastName($_POST['lastname']); ! ! ! ! $customerValidator = MyAppValidatorsCustomerValidator::getInstance(); ! ! if ($customerValidator->validate($customer)) { ! ! ! $customer->save(); ! ! ! $this->logger->log('A new customer was saved'); ! ! } else { ! ! ! throw new InvalidCustomerException(); ! ! } ! } Fluent Development with FLOW3 Inspiring people to share
  • 12. <?php ! /** ! * Creates a customer ! * ! * @return void ! */ ! public function createAction() { ! ! if ($this->arguments->hasErrors()) $this->throwStatus(400, 'Bad Request', '<strong>Invalid arguments!</strong>'); ! ! $customer = new DomainModelCustomer(); ! ! $this->dataMapper->map($this->arguments['customer'], $customer); ! ! $this->customerRepository->add($customer); ! ! $this->throwStatus(201); ! } ?> Fluent Development with FLOW3 Inspiring people to share
  • 13. FLOW3 = Application Framework Not just a collection of components or code snippet library Comes with ready-to-go default configuration Package based PHP 5 Runs with PHP 5.3 or later.3alpha 1 Comes with a powerful JSR-283 based Content Repository Fluent Development with FLOW3 Inspiring people to share
  • 14. Finest Handmade PHP Code 100% documented source code (top project at Ohloh) Consistent and intuitive class, method and variable names FLOW3 Core Team always develops test-driven Continuous Integration multiple commits each day automatic tests for Linux, Windows and Mac with SQLite, MySQL and Postgres open CI server with statistics, email and jabber notifications Fluent Development with FLOW3 Inspiring people to share
  • 15. FLOW3 modules AOP Locale Reflection Component Log Resource Configuration MVC Security Cache Package Utility Error Persistence Validation Event Property ... and more Fluent Development with FLOW3 Inspiring people to share
  • 16. Getting Started Fluent Development with FLOW3 Inspiring people to share
  • 17. Getting Started Requirements Some webserver (tested with Apache and IIS) PHP 5.3alpha1 or higher (see http://snaps.php.net/) PHP extensions: zlib, PDO and PDO SQLite and the usual stuff Some database (tested with SQLite, MySQL and Postgres) Fluent Development with FLOW3 Inspiring people to share
  • 18. Getting Started Download Currently available through Subversion Checkout the FLOW3 Distribution: svn co https://svn.typo3.org/FLOW3/distribution/trunk or try the TYPO3 Distribution: svn co https://svn.typo3.org/TYPO3v5/distribution/trunk Nightly builds will follow after the 1.0 alpha 1 release Fluent Development with FLOW3 Inspiring people to share
  • 19. Fluent Development with FLOW3 Inspiring people to share
  • 20. Getting Started Grant File Permissions The webserver needs read access for all files of the distribution and write access in the Public and Data directory On Linux / Mac just call sudo ./fixpermissions.sh On legacy operating systems: ask your system administrator Fluent Development with FLOW3 Inspiring people to share
  • 21. Getting Started Create a package In order to create a new package, just create a new folder within the Packages directory. Fluent Development with FLOW3 Inspiring people to share
  • 22. Getting Started Create a Default Controller Create a subfolder in your package: Classes/Controller/ Create the controller class file: <?php declare(ENCODING = 'utf-8'); namespace F3MyPackageController; class DefaultController extends F3FLOW3MVCControllerActionController { ! public function indexAction() { ! ! return 'Hello World!'; ! } } ?> Fluent Development with FLOW3 Inspiring people to share
  • 23. Bootstrap Fluent Development with FLOW3 Inspiring people to share
  • 24. 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 define('FLOW3_PATH_PUBLIC', str_replace('', '/', __DIR__) . '/'); require(FLOW3_PATH_PUBLIC . '../Packages/FLOW3/Classes/F3_FLOW3.php'); $framework = new F3FLOW3(); $framework->run(); Fluent Development with FLOW3 Inspiring people to share
  • 25. 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 define('FLOW3_PATH_PUBLIC', str_replace('', '/', __DIR__) . '/'); require(FLOW3_PATH_PUBLIC . '../Packages/FLOW3/Classes/F3_FLOW3.php'); $framework = new F3FLOW3('Development'); $framework->run(); Fluent Development with FLOW3 Inspiring people to share
  • 26. Model - View - Controller Fluent Development with FLOW3 Inspiring people to share
  • 27. MVC Key Features Powerful Request-Response mechanism, based on Front Controller and Dispatcher Very convenient controllers and views Supports multiple template engines Sophisticated, easy to configure routing Built-in validation and default security REST support Fluent Development with FLOW3 Inspiring people to share
  • 28. MVC Model Types Active Record Domain Model Model of / wrapper for a Model of a domain which consists of database table row data and behaviour is responsible for persistence doesn't know about persistence mixes infrastructure concerns with model doesn't know about infrastructure quick to implement without a framework clean and easy to use if framework supports it Fluent Development with FLOW3 Inspiring people to share
  • 29. MVC Pattern Model Active Record Domain Model Model of / wrapper for a Model of a domain which consists of database table row data and behaviour is responsible for persistence doesn't know about persistence mixes infrastructure concerns with model doesn't know about infrastructure quick to implement without a framework clean and easy to use if framework supports it Fluent Development with FLOW3 Inspiring people to share
  • 30. MVC Pattern Model Active Record Domain Model Model of / wrapper for a Model of a domain which consists of database table row data and behaviour is responsible for persistence doesn't know about persistence mixes infrastructure concerns with model doesn't know about infrastructure quick to implement without a framework clean and easy to use if framework supports it Fluent Development with FLOW3 Inspiring people to share
  • 31. Persistence Fluent Development with FLOW3 Inspiring people to share
  • 32. Persistence JSR-283 based Content Repository Defines a uniform API for accessing content repositories A Content Repository is a kind of object database for storage, search and retrieval of hierarchical data provides methods for versioning, transactions and monitoring TYPO3CR is the first working port of JSR-170 / JSR-283 Karsten Dambekalns is member of the JSR-283 expert group Fluent Development with FLOW3 Inspiring people to share
  • 33. Persistence Transparent Persistence Explicit support for Domain-Driven Design Class Schemata are defined by the Domain Model class No need to write an XML or YAML schema definition No need to define the database model and object model multiple times at different places Automatic persistence in the JSR-283 based Content Repository Legacy data sources can be mounted Fluent Development with FLOW3 Inspiring people to share
  • 34. Components Fluent Development with FLOW3 Inspiring people to share
  • 35. 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 Fluent Development with FLOW3 Inspiring people to share
  • 36. 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 Fluent Development with FLOW3 Inspiring people to share
  • 37. Components Autowiring FLOW3 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 Fluent Development with FLOW3 Inspiring people to share
  • 38. DEMO Fluent Development with FLOW3 Inspiring people to share
  • 39. Security Fluent Development with FLOW3 Inspiring people to share
  • 40. Playground Fluent Development with FLOW3 Inspiring people to share
  • 41. Things to play with F3BLOG Try out the Blog Example: svn co https://svn.typo3.org/FLOW3/Distribution/branches/BlogExample/ Fluent Development with FLOW3 Inspiring people to share
  • 42. Things to play with TYPO3CR Admin Play with persistence and watch your object in the TYPO3CR Admin Fluent Development with FLOW3 Inspiring people to share
  • 43. Things to play with Testrunner Experiment with Test-Driven Development and watch the tests in FLOW3's test runner Fluent Development with FLOW3 Inspiring people to share
  • 44. Progress Developing FLOW3 ... Fluent Development with FLOW3 Inspiring people to share
  • 45. Next Steps First FLOW3 alpha release end of this year First pilot projects based on FLOW3 in spring '09 Further development of the TYPO3 package Planned release of TYPO3 5.0 alpha: end of 2009 Fluent Development with FLOW3 Inspiring people to share
  • 46. Links These Slides http://flow3.typo3.org/documentation/slides/ FLOW3 Website http://flow3.typo3.org TYPO3 Forge http://forge.typo3.org Further Reading http://flow3.typo3.org/about/principles/further-reading/ Fluent Development with FLOW3 Inspiring people to share
  • 47. Questions Fluent Development with FLOW3 Inspiring people to share