ipcse12: hands on flow3
DESCRIPTION
The FLOW3 framework got a lot of attention when version 1.0 was released after years of development. Its main approach is to deliver a whole-in-one concept for modern programming techniques and guiding developers to write excellent code. This session takes you on a tour through FLOW3's key features by demonstrating the making of a real application.TRANSCRIPT
Robert Lemke
Hands on FLOW3
project founder of FLOW3 and TYPO3 “Phoenix”
co-founder of the TYPO3 Association
coach, coder, consultant
36 years old
lives in Lübeck, Germany
1 wife, 2 daughters, 1 espresso machine
likes drumming
Robert Lemke
At a Glance
FLOW3 is a web application platform
• holistic concept for your apps
• modular, extensible, package based
• pedantically clean with focus on quality
• puts a smile on developer’s faces
• free & Open Source (LGPL v3)
• backed by one of the largest Open Source projects
Foundation for the Next Generation CMS
TYPO3 “Phoenix” is the all-new Enterprise CMS
• content repository, workspaces, versions, i18n, modular UI ...
• powered by FLOW3
• compatible code base
• use TYPO3 features in FLOW3 standalone apps as you like
TEXT HERE
1. Command Line
TEXT HERE
2. Action Controller
3. Templating
TEXT HERE
4. Models
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
5. Persistence
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
6. Domain-Driven Design
Tackling the Heart of Software Development
Domain-Driven DesignA methodology which ...
• results in rich domain models
• provides a common language across the project team
• simplify the design of complex applications
FLOW3 is the first PHP framework tailored to Domain-Driven Design
/** * A Book * * @FLOW3\Scope(“prototype”) * @FLOW3\Entity */class Book {
/** * @var string */ protected $title;
/** * @var string */ protected $isbn;
/** * @var string */ protected $description;
/** * @var integer */ protected $price;
/** * @var \SplObjectStorage */ protected $materials;
/** * @var \Acme\Conference\Domain\Model\SessionType * @validate NotEmpty */ protected $proposedSessionType;
/** * Constructs a new Paper * * @author Robert Lemke <[email protected]> */ public function __construct() { $this->materials = new \SplObjectStorage; }
/** * Sets the author of this paper * * @param \Acme\Conference\Domain\Model\Participant $author * @return void * @author Robert Lemke <[email protected]> */ public function setAuthor(\Acme\Conference\Domain\Model\Participant $author) { $this->author = $author; }
/** * Getter for the author of this paper * * @return \Acme\Conference\Domain\Model\Participant * @author Robert Lemke <[email protected]> */ public function getAuthor() { return $this->author; }
/** * Setter for title * * @param string $title The title of this paper * @return void * @author Robert Lemke <[email protected]> */ public function setTitle($title) { $this->title = $title; }
/** * Getter for title * * @return string The title of this paper * @author Robert Lemke <[email protected]> */ public function getTitle() { return $this->title; }
/** * Setter for the short abstract * * @param string $shortAbstract The short abstract for this paper * @return void * @author Robert Lemke <[email protected]> */ public function setShortAbstract($shortAbstract) { $this->shortAbstract = $shortAbstract; }
/** * Getter for the short abstract * * @return string The short abstract * @author Robert Lemke <[email protected]> */ public function getShortAbstract() { return $this->shortAbstract; }
/** * Setter for abstract * * @param string $abstract The abstract of this paper * @return void * @author Robert Lemke <[email protected]> */ public function setAbstract($abstract) { $this->abstract = $abstract; }
/** * Getter for abstract * * @return string The abstract * @author Robert Lemke <[email protected]> */ public function getAbstract() { return $this->abstract; }
/** * Returns the materials attached to this paper * * @return \SplObjectStorage The materials * @author Robert Lemke <[email protected]> */ public function getMaterials() { return $this->materials; }
/** * Setter for the proposed session type * * @param \Acme\Conference\Domain\Model\SessionType $proposedSessionType The proposed session type * @return void * @author Robert Lemke <[email protected]> */ public function setProposedSessionType(\Acme\Conference\Domain\Model\SessionType $proposedSessionType) { $this->proposedSessionType = $proposedSessionType; }
/** * Getter for the proposed session type * * @return \Acme\Conference\Domain\Model\SessionType The proposed session type * @author Robert Lemke <[email protected]> */ public function getProposedSessionType() { return $this->proposedSessionType; }}?>
Domain-Driven Design
7. Resources
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
7. Dependency Injection
TEXT HERE
TEXT HERE
Object Management
FLOW3'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 gatered automatically (autowiring)
• intuitive use and no bad magical surprises
• fast! (like hardcoded or faster)
namespace Acme\Demo\Controller;
use TYPO3\FLOW3\Mvc\Controller\ActionController;use Acme\Demo\Service\GreeterService;
class DemoController extends ActionController { /** * @var \Acme\Demo\Service\GreeterService */ protected $greeterService;
/** * @param \Acme\Demo\Service\GreeterService */ public function __construct(GreeterService $greeterService) { $this->greeterService = $greeterService; } /** * @param string $name */ public function helloAction($name) { return $this->greeterService->greet($name); }}
Constructor Injection
namespace Acme\Demo\Controller;
use TYPO3\FLOW3\MVC\Controller\ActionController;use Acme\Demo\Service\GreeterService;
class DemoController extends ActionController { /** * @var \Acme\Demo\Service\GreeterService */ protected $greeterService;
/** * @param \Acme\Demo\Service\GreeterService */ public function injectGreeterService(GreeterService $greeterService) { $this->greeterService = $greeterService; } /** * @param string $name */ public function helloAction($name) { return $this->greeterService->greet($name); }}
Setter Injection
namespace TYPO3\Demo\Controller;
use TYPO3\FLOW3\Annotations as FLOW3;use TYPO3\FLOW3\MVC\Controller\ActionController;use Acme\Demo\Service\GreeterService;
class DemoController extends ActionController { /** * @var \TYPO3\Demo\Service\GreeterService * @FLOW3\Inject */ protected $greeterService; /** * @param string $name */ public function helloAction($name) { return $this->greeterService->greet($name); }}
Property Injection
TEXT HERE
8. Sessions
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
9. Security
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
FLOW3 1.0 FLOW3 1.1transactions / second 27 71
longest transaction 1.06 0.38
shortest transaction 0.19 0.08
memory peak 19,8 MB 5,1 MB
Project X
?
Thanks for having me!
Slides: http://slideshare.net/robertlemke
Examples: http://github.com/robertlemke
Blog: http://robertlemke.com
Twitter: @robertlemke
Feedback: [email protected]
FLOW3: http://flow3.typo3.org