SlideShare ist ein Scribd-Unternehmen logo
1 von 77
Downloaden Sie, um offline zu lesen
The Joy of Development
project founder of
Flow and Neos

coach, coder, consultant

Lübeck, Germany

1 wife, 2 daughters,
                       TEXT HERE
1 espresso machine

likes drumming
2005
modelviewcontroller
HTTP
Network Working Group                                           R. Fielding
Request for Comments: 2616                                        UC Irvine
Obsoletes: 2068                                                   J. Gettys
Category: Standards Track                                        Compaq/W3C
                                                                   J. Mogul
                                                                     Compaq
                                                                 H. Frystyk
                                                                    W3C/MIT
                                                                L. Masinter
                                                                      Xerox
                                                                   P. Leach
                                                                  Microsoft
                                                             T. Berners-Lee
                                                                    W3C/MIT
                                                                  June 1999




                   Hypertext Transfer Protocol -- HTTP/1.1


Status of this Memo


   This document specifies an Internet standards track protocol for the
   Internet community, and requests discussion and suggestions for
   improvements.     Please refer to the current edition of the "Internet
HTTP/1.1 has been designed to allow implementations of applications
                                                     /**
   that do not depend on knowledge of ranges.
                                                      * Represents a HTTP request
                                                      */
4 HTTP Message
                                                     class Request extends Message {

4.1 Message Types
                                                         /**
                                                           * @var string
   HTTP messages consist of requests from client to    server and responses
                                                           */
   from server to client.
                                                         protected $method = 'GET';

       HTTP-message   = Request | Response       ; HTTP/1.1 messages
                                                        /**
                                                          * @var TYPO3FlowHttpUri
   Request   (section 5) and Response (section 6) messages use the generic
                                                          */
   message   format of RFC 822 [9] for transferring entities (the payload
                                                        protected $uri;
   of the message). Both types of message consist of a start-line, zero
   or more header fields (also known as "headers"), an empty line (i.e.,
                                                        /**
   a line with nothing preceding the CRLF) indicating   the end of the
                                                          * @var TYPO3FlowHttpUri
   header fields, and possibly a message-body.
                                                          */
                                                        protected $baseUri;
        generic-message = start-line
                            *(message-header CRLF)
                                                         /**
                            CRLF
                                                          * @var array
                            [ message-body ]
                                                          */
        start-line      = Request-Line | Status-Line
                                                         protected $arguments;
$request->getHeader('User-Agent'); # C64

$request->setHeader('X-Coffee', 'too few');
$now = new DateTime();
$response->setLastModified($now);
$response->getHeaders()
  ->setCacheControlDirective('s-max-age', 100);
# set cookie in response:
$response->setCookie(new Cookie('counter', 1));

  # on next request, retrieve cookie:
$cookie = $request->getCookie('counter');
$response = $browser->request('http://robertlemke.com/home');
$content = $response->getContent();
$request = Request::create($storageUri, 'PUT');
$request->setContent(fopen('myfavoritemovie.m4v', 'rb'));
$request->setHeader('X-Category', 'Sissy');

$reponse = $browser->sendRequest($request);
Model
Domain-Driven Design                       /**
                                            * A Book
                                            *
A methodology which ...                     * @FlowScope(“prototy
                                                                   pe”)
                                            * @FlowEntity
                                            */
• results in rich domain models           class Book {

                                           /**
• provides a common language across         * @var string
  the project team                          */
                                           protected $title;

• simplify the design of complex           /**
                                            * @var string
  applications                              */
                                           protected $isbn;

                                          /**
Flow is the first PHP framework tailored    * @var string
                                           */
to Domain-Driven Design                   protected $description
                                                                 ;

                                          /**
                                           * @var integer
                                           */
                                          protected $price;
/**
 * A Book
 *
 * @FlowEntity
 */
class Book {

  /**
   * The title
   * @var string
   * @FlowValidate(type="StringLength", options={ "minimum"=1,
   */
  protected $title;

  /**
   * The price
   * @var integer
   * @FlowValidate(type="NumberRange", options={ "minimum"=1,
   */
  protected $price;
/**
  * Get the Book's title
  *
  * @return string The Book's title
  */
public function getTitle() {
    return $this->title;
}

/**
  * Sets this Book's title
  *
  * @param string $title The Book's title
  * @return void
  */
public function setTitle($title) {
    $this->title = $title;
}
/**
 * A repository for Books
 *
 * @FlowScope("singleton")
 */
class BookRepository extends Repository {

    public function findBestSellers() {
      ...
    }

}
# Add a book
$bookRepository->add($book);

  # Remove a book
$bookRepository->remove($book);

  # Update a book
$bookRepository->update($book);
# Find one specific book
$book = $bookRepository->findOneByTitle('Lord of the Rings');

  # Find multiple books by property
$books = $bookRepository->findByCategory('Fantasy');

  # Find books through custom find method
$bestsellingBooks = $bookRepository->findBestSellers();
TEXT HERE
TEXT HERE
Controller
class HelloWorldController extends ActionController {

    /**
      * @return string
      */
    public function greetAction() {
         return 'Hello World!';
    }

}
Hello World!


           TEXT HERE
/**
  * An action which sends greetings to $name
  *
  * @param string $name The name to mention
  * @return string
  */
public function greetAction($name) {
     return "Hello $name!";
}
dev.demo.local/acme.demo/helloworld/greet.html?name=Robert

                 dev.demo.local/acme.demo/helloworld/greet.html?name=Robert




Hello Robert!
View
<html lang="en">
    <head>
        <title>Templating</title>
    </head>
    <body>

          Our templating engine
          is called

                         Fluid
    </body>
</html>
/**
  * @param string $name
  * @return void
  */
public function greetAction($name) {
     $this->view->assign('name', $name);
}
<html>
    <head>
        <title>Fluid Example</title>
    </head>
    <body>
        <p>Hello, {name}!</p>
    </body>
</html>
/**
  * Displays a list of best selling books
  *
  * @return void
  */
public function indexAction() {
    $books = $this->bookRepository->findBestSellers();
    $this->view->assign('books', $books);
}
<ul>
   <f:for each="{books}" as="book">
       <li>{book.title} by {book.author.name}</li>
   </f:for>
</ul>
<html xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers">
<f:form action="create" name="newBook">
    <ol>
         <li>
              <label for="name">Name</label>
              <f:form.textfield property="name" id="name" />
         </li>
         <li>
              <f:form.submit value="Create" />
         </li>
    </ol>
</f:form>
/**
  * Adds the given new book to the BookRepository
  *
  * @param AcmeDemoDomainModelBook $newBook
  * @return void
  */
public function createAction(Book $newBook) {
    $this->bookRepository->add($newBook);
    $this->addFlashMessage('Created a new book.');
    $this->redirect('index');
}
Resources
Static Resources
Static Resources
Static Resources
Persistent Resources
Persistent Resources
Dependency Injection
class SomeService {

      protected static $instance;

      public function getInstance() {
        if (self::$instance === NULL) {
          self::$instance = new self;
        }
        return self::$instance;
      }
}



class SomeOtherController {

    public function action() {
      $service = SomeService::getInstance();
      …
    }

}
class ServiceLocator {

      protected static $services = array();

      public function getInstance($name) {
        return self::$service[$name];
      }

}



class SomeOtherController {

    public function action() {
      $service = ServiceLocate::getInstance("SomeService");
      …
    }

}
Flow's take on Dependency Injection
• one of the first PHP implementations
  (started in 2006, improved ever since)

• object management for the whole lifecycle of all objects

• no unnecessary configuration if information can be
  gathered automatically (autowiring)

• intuitive use and no bad magical surprises

• fast! (like hardcoded or faster)
class BookController extends ActionController {

    /**
     * @var BookRepository
     */
    protected $bookRepository;

    /**
      * @param BookRepository $bookRepository
      */
    public function __construct(BookRepository $bookRepository) {
       $this->bookRepository = $bookRepository;
    }

}
class BookController extends ActionController {

    /**
     * @var BookRepository
     */
    protected $bookRepository;

  /**
    * @param BookRepository $bookRepository
    */
  public function injectBookRepository(BookRepository
$bookRepository) {
     $this->bookRepository = $bookRepository;
  }

}
class BookController extends ActionController {

    /**
     * @FlowInject
     * @var BookRepository
     */
    protected $bookRepository;

}
Aspect-Oriented Programming
/**
  * An action which sends greetings to $name
  *
  * @param string $name The name to mention
  * @return string
  */
public function greetAction($name) {
     return "Hello $name!";
}
dev.demo.local/acme.demo/helloworld/greet.html?name=Robert

                 dev.demo.local/acme.demo/helloworld/greet.html?name=Robert




Hello Robert!
/**
 * @FlowAspect
 */
class DemoAspect {

    /**
      * @param TYPO3FlowAopJoinPointInterface $joinPoint
      * @return void
      * @FlowAround("method(.*->greetAction())")
      */
    public function demoAdvice(JoinPointInterface $joinPoint) {
       $name = $joinPoint->getMethodArgument('name');
       return sprintf('%s, you are running out of time!');
    }
}
dev.demo.local/acme.demo/helloworld/greet.html?name=Robert

                 dev.demo.local/acme.demo/helloworld/greet.html?name=Robert




Robert, you are running out of time!
Security
resources:
  methods:
    BookManagementMethods: 'method(.*Controller->(new|create|
edit|update|delete)Action())'

roles:
  Customer: []
  Administrator: []

acls:
  Administrator:
    methods:
      BookManagementMethods: GRANT
Access Denied   (in Development context)
Sessions
/**
 * A Basket
 *
 * @FlowScope("session")
 */
class Basket {

  /**
   * The books
   * @var array
   */
  protected $books;

  /**
    * Adds a book to the basket
    *
    * @param RoeBooksShopDomainModelBasketook $book
    * @return void
    * @FlowSession(autoStart=true)
    */
  public function addBook (Book $book) {
      $this->books[] = $book;
  }
TEXT HERE
TEXT HERE
TEXT HERE
Rossmann
• second biggest drug store
  in Germany
• 5,13 billion € turnover
• 31,000 employees



Customer Database
Amadeus
• world’s biggest
  e-ticket provider
• 217 markets
• 948 million billable
  transactions / year
• 2,7 billion € revenue

Social Media Suite
World of Textile
• textile print and finishing
• 30,000 articles / day
• 180 employees




E-Commerce Platform
2.0
neos.typo3.org
?
Thank you!
Flow      flow.typo3.org
Slides    slideshare.net/robertlemke
Blog      robertlemke.com
Twitter   @robertlemke
Google+   plus.robertlemke.com

Weitere ähnliche Inhalte

Andere mochten auch

TYPO3 Flow - PHP Framework for Developer Happiness
TYPO3 Flow - PHP Framework for Developer HappinessTYPO3 Flow - PHP Framework for Developer Happiness
TYPO3 Flow - PHP Framework for Developer Happiness
Christian Müller
 

Andere mochten auch (12)

TYPO3 Flow a solid foundation for medialib.tv
TYPO3 Flow a solid foundation for medialib.tvTYPO3 Flow a solid foundation for medialib.tv
TYPO3 Flow a solid foundation for medialib.tv
 
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
 
TYPO3 Flow 2.0 (International PHP Conference 2013)
TYPO3 Flow 2.0 (International PHP Conference 2013)TYPO3 Flow 2.0 (International PHP Conference 2013)
TYPO3 Flow 2.0 (International PHP Conference 2013)
 
TYPO3 Flow 2.0 Workshop T3BOARD13
TYPO3 Flow 2.0 Workshop T3BOARD13TYPO3 Flow 2.0 Workshop T3BOARD13
TYPO3 Flow 2.0 Workshop T3BOARD13
 
T3CON14EU: Migrating from TYPO3 CMS to TYPO3 Flow
T3CON14EU: Migrating from TYPO3 CMS to TYPO3 FlowT3CON14EU: Migrating from TYPO3 CMS to TYPO3 Flow
T3CON14EU: Migrating from TYPO3 CMS to TYPO3 Flow
 
T3CON12 Flow and TYPO3 deployment with surf
T3CON12 Flow and TYPO3 deployment with surfT3CON12 Flow and TYPO3 deployment with surf
T3CON12 Flow and TYPO3 deployment with surf
 
TYPO3 Flow: Beyond the Blog Example (Inspiring Flow 2013)
TYPO3 Flow: Beyond the Blog Example (Inspiring Flow 2013)TYPO3 Flow: Beyond the Blog Example (Inspiring Flow 2013)
TYPO3 Flow: Beyond the Blog Example (Inspiring Flow 2013)
 
TYPO3 5.0 Experience Concept
TYPO3 5.0 Experience ConceptTYPO3 5.0 Experience Concept
TYPO3 5.0 Experience Concept
 
TYPO3 Flow - PHP Framework for Developer Happiness
TYPO3 Flow - PHP Framework for Developer HappinessTYPO3 Flow - PHP Framework for Developer Happiness
TYPO3 Flow - PHP Framework for Developer Happiness
 
Testing TYPO3 Flow Applications with Behat
Testing TYPO3 Flow Applications with BehatTesting TYPO3 Flow Applications with Behat
Testing TYPO3 Flow Applications with Behat
 
TYPO3 Neos - past, present and future (T3CON14EU)
TYPO3 Neos - past, present and future (T3CON14EU)TYPO3 Neos - past, present and future (T3CON14EU)
TYPO3 Neos - past, present and future (T3CON14EU)
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 Flow
 

Ähnlich wie TYPO3 Flow and the Joy of Development (FOSDEM 2013)

2012 08-11-flow3-northeast-php
2012 08-11-flow3-northeast-php2012 08-11-flow3-northeast-php
2012 08-11-flow3-northeast-php
Jochen Rau
 
Iss letcure 7_8
Iss letcure 7_8Iss letcure 7_8
Iss letcure 7_8
Ali Habeeb
 
Using Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSUsing Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RS
Katrien Verbert
 
03 form-data
03 form-data03 form-data
03 form-data
snopteck
 

Ähnlich wie TYPO3 Flow and the Joy of Development (FOSDEM 2013) (20)

Hands on FLOW3 (DPC12)
Hands on FLOW3 (DPC12)Hands on FLOW3 (DPC12)
Hands on FLOW3 (DPC12)
 
IPCSE12: Hands on FLOW3
IPCSE12: Hands on FLOW3IPCSE12: Hands on FLOW3
IPCSE12: Hands on FLOW3
 
Getting Into FLOW3 (DPC12)
Getting Into FLOW3 (DPC12)Getting Into FLOW3 (DPC12)
Getting Into FLOW3 (DPC12)
 
2012 08-11-flow3-northeast-php
2012 08-11-flow3-northeast-php2012 08-11-flow3-northeast-php
2012 08-11-flow3-northeast-php
 
IPCSE12: Getting into FLOW3
IPCSE12: Getting into FLOW3IPCSE12: Getting into FLOW3
IPCSE12: Getting into FLOW3
 
Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0
 
Getting Into FLOW3 (TYPO312CA)
Getting Into FLOW3 (TYPO312CA)Getting Into FLOW3 (TYPO312CA)
Getting Into FLOW3 (TYPO312CA)
 
FLOW3 Tutorial - T3CON11 Frankfurt
FLOW3 Tutorial - T3CON11 FrankfurtFLOW3 Tutorial - T3CON11 Frankfurt
FLOW3 Tutorial - T3CON11 Frankfurt
 
The Beauty and the Beast
The Beauty and the BeastThe Beauty and the Beast
The Beauty and the Beast
 
The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09
 
Doctrine in FLOW3
Doctrine in FLOW3Doctrine in FLOW3
Doctrine in FLOW3
 
Php Documentor The Beauty And The Beast
Php Documentor The Beauty And The BeastPhp Documentor The Beauty And The Beast
Php Documentor The Beauty And The Beast
 
jkljklj
jkljkljjkljklj
jkljklj
 
Iss letcure 7_8
Iss letcure 7_8Iss letcure 7_8
Iss letcure 7_8
 
Mxhr
MxhrMxhr
Mxhr
 
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
 
Inside DocBlox
Inside DocBloxInside DocBlox
Inside DocBlox
 
Using Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSUsing Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RS
 
03 form-data
03 form-data03 form-data
03 form-data
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 

Mehr von Robert Lemke

Mehr von 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
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

TYPO3 Flow and the Joy of Development (FOSDEM 2013)

  • 1. The Joy of Development
  • 2. project founder of Flow and Neos coach, coder, consultant Lübeck, Germany 1 wife, 2 daughters, TEXT HERE 1 espresso machine likes drumming
  • 3.
  • 5.
  • 7.
  • 9. Network Working Group R. Fielding Request for Comments: 2616 UC Irvine Obsoletes: 2068 J. Gettys Category: Standards Track Compaq/W3C J. Mogul Compaq H. Frystyk W3C/MIT L. Masinter Xerox P. Leach Microsoft T. Berners-Lee W3C/MIT June 1999 Hypertext Transfer Protocol -- HTTP/1.1 Status of this Memo This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet
  • 10. HTTP/1.1 has been designed to allow implementations of applications /** that do not depend on knowledge of ranges. * Represents a HTTP request */ 4 HTTP Message class Request extends Message { 4.1 Message Types /** * @var string HTTP messages consist of requests from client to server and responses */ from server to client. protected $method = 'GET'; HTTP-message = Request | Response ; HTTP/1.1 messages /** * @var TYPO3FlowHttpUri Request (section 5) and Response (section 6) messages use the generic */ message format of RFC 822 [9] for transferring entities (the payload protected $uri; of the message). Both types of message consist of a start-line, zero or more header fields (also known as "headers"), an empty line (i.e., /** a line with nothing preceding the CRLF) indicating the end of the * @var TYPO3FlowHttpUri header fields, and possibly a message-body. */ protected $baseUri; generic-message = start-line *(message-header CRLF) /** CRLF * @var array [ message-body ] */ start-line = Request-Line | Status-Line protected $arguments;
  • 12. $now = new DateTime(); $response->setLastModified($now);
  • 14. # set cookie in response: $response->setCookie(new Cookie('counter', 1)); # on next request, retrieve cookie: $cookie = $request->getCookie('counter');
  • 16. $request = Request::create($storageUri, 'PUT'); $request->setContent(fopen('myfavoritemovie.m4v', 'rb')); $request->setHeader('X-Category', 'Sissy'); $reponse = $browser->sendRequest($request);
  • 17. Model
  • 18. Domain-Driven Design /** * A Book * A methodology which ... * @FlowScope(“prototy pe”) * @FlowEntity */ • results in rich domain models class Book { /** • provides a common language across * @var string the project team */ protected $title; • simplify the design of complex /** * @var string applications */ protected $isbn; /** Flow is the first PHP framework tailored * @var string */ to Domain-Driven Design protected $description ; /** * @var integer */ protected $price;
  • 19. /** * A Book * * @FlowEntity */ class Book { /** * The title * @var string * @FlowValidate(type="StringLength", options={ "minimum"=1, */ protected $title; /** * The price * @var integer * @FlowValidate(type="NumberRange", options={ "minimum"=1, */ protected $price;
  • 20. /** * Get the Book's title * * @return string The Book's title */ public function getTitle() { return $this->title; } /** * Sets this Book's title * * @param string $title The Book's title * @return void */ public function setTitle($title) { $this->title = $title; }
  • 21. /** * A repository for Books * * @FlowScope("singleton") */ class BookRepository extends Repository { public function findBestSellers() { ... } }
  • 22. # Add a book $bookRepository->add($book); # Remove a book $bookRepository->remove($book); # Update a book $bookRepository->update($book);
  • 23. # Find one specific book $book = $bookRepository->findOneByTitle('Lord of the Rings'); # Find multiple books by property $books = $bookRepository->findByCategory('Fantasy'); # Find books through custom find method $bestsellingBooks = $bookRepository->findBestSellers();
  • 27. class HelloWorldController extends ActionController { /** * @return string */ public function greetAction() { return 'Hello World!'; } }
  • 28. Hello World! TEXT HERE
  • 29. /** * An action which sends greetings to $name * * @param string $name The name to mention * @return string */ public function greetAction($name) { return "Hello $name!"; }
  • 30.
  • 31. dev.demo.local/acme.demo/helloworld/greet.html?name=Robert dev.demo.local/acme.demo/helloworld/greet.html?name=Robert Hello Robert!
  • 32. View
  • 33. <html lang="en"> <head> <title>Templating</title> </head> <body> Our templating engine is called Fluid </body> </html>
  • 34. /** * @param string $name * @return void */ public function greetAction($name) { $this->view->assign('name', $name); }
  • 35. <html> <head> <title>Fluid Example</title> </head> <body> <p>Hello, {name}!</p> </body> </html>
  • 36. /** * Displays a list of best selling books * * @return void */ public function indexAction() { $books = $this->bookRepository->findBestSellers(); $this->view->assign('books', $books); }
  • 37. <ul> <f:for each="{books}" as="book"> <li>{book.title} by {book.author.name}</li> </f:for> </ul>
  • 39. <f:form action="create" name="newBook"> <ol> <li> <label for="name">Name</label> <f:form.textfield property="name" id="name" /> </li> <li> <f:form.submit value="Create" /> </li> </ol> </f:form>
  • 40. /** * Adds the given new book to the BookRepository * * @param AcmeDemoDomainModelBook $newBook * @return void */ public function createAction(Book $newBook) { $this->bookRepository->add($newBook); $this->addFlashMessage('Created a new book.'); $this->redirect('index'); }
  • 46.
  • 49. class SomeService { protected static $instance; public function getInstance() { if (self::$instance === NULL) { self::$instance = new self; } return self::$instance; } } class SomeOtherController { public function action() { $service = SomeService::getInstance(); … } }
  • 50. class ServiceLocator { protected static $services = array(); public function getInstance($name) { return self::$service[$name]; } } class SomeOtherController { public function action() { $service = ServiceLocate::getInstance("SomeService"); … } }
  • 51. Flow's take on Dependency Injection • one of the first PHP implementations (started in 2006, improved ever since) • object management for the whole lifecycle of all objects • no unnecessary configuration if information can be gathered automatically (autowiring) • intuitive use and no bad magical surprises • fast! (like hardcoded or faster)
  • 52. class BookController extends ActionController { /** * @var BookRepository */ protected $bookRepository; /** * @param BookRepository $bookRepository */ public function __construct(BookRepository $bookRepository) { $this->bookRepository = $bookRepository; } }
  • 53. class BookController extends ActionController { /** * @var BookRepository */ protected $bookRepository; /** * @param BookRepository $bookRepository */ public function injectBookRepository(BookRepository $bookRepository) { $this->bookRepository = $bookRepository; } }
  • 54. class BookController extends ActionController { /** * @FlowInject * @var BookRepository */ protected $bookRepository; }
  • 56. /** * An action which sends greetings to $name * * @param string $name The name to mention * @return string */ public function greetAction($name) { return "Hello $name!"; }
  • 57. dev.demo.local/acme.demo/helloworld/greet.html?name=Robert dev.demo.local/acme.demo/helloworld/greet.html?name=Robert Hello Robert!
  • 58. /** * @FlowAspect */ class DemoAspect { /** * @param TYPO3FlowAopJoinPointInterface $joinPoint * @return void * @FlowAround("method(.*->greetAction())") */ public function demoAdvice(JoinPointInterface $joinPoint) { $name = $joinPoint->getMethodArgument('name'); return sprintf('%s, you are running out of time!'); } }
  • 59. dev.demo.local/acme.demo/helloworld/greet.html?name=Robert dev.demo.local/acme.demo/helloworld/greet.html?name=Robert Robert, you are running out of time!
  • 61.
  • 62. resources: methods: BookManagementMethods: 'method(.*Controller->(new|create| edit|update|delete)Action())' roles: Customer: [] Administrator: [] acls: Administrator: methods: BookManagementMethods: GRANT
  • 63.
  • 64. Access Denied (in Development context)
  • 66. /** * A Basket * * @FlowScope("session") */ class Basket { /** * The books * @var array */ protected $books; /** * Adds a book to the basket * * @param RoeBooksShopDomainModelBasketook $book * @return void * @FlowSession(autoStart=true) */ public function addBook (Book $book) { $this->books[] = $book; }
  • 70.
  • 71. Rossmann • second biggest drug store in Germany • 5,13 billion € turnover • 31,000 employees Customer Database
  • 72. Amadeus • world’s biggest e-ticket provider • 217 markets • 948 million billable transactions / year • 2,7 billion € revenue Social Media Suite
  • 73. World of Textile • textile print and finishing • 30,000 articles / day • 180 employees E-Commerce Platform
  • 74. 2.0
  • 76. ?
  • 77. Thank you! Flow flow.typo3.org Slides slideshare.net/robertlemke Blog robertlemke.com Twitter @robertlemke Google+ plus.robertlemke.com