Download - 2012 08-11-flow3-northeast-php
Get into
the flow
with FLOW3
Jochen Rau
Demo App: https://github.com/jocrau/RoeBooks.Shop
Stuttgart
Who is this?
Hatfield
Who is this?
Researcher & Project ManagerFraunhofer-GesellschaftGerman Aerospace Center
Who is this?
High School TeacherMathematics and Physics
Who is this?
Infected withTYPO3 and FLOW3
in 2OO6
Who is this?
Infected withTYPO3 and FLOW3
in 2OO6
Who is this?
ConsultantSoftware EngineerInfinite Cloud LLC
Who is this?
project founderFLOW3 and TYPO3 “Phoenix”
co-founder TYPO3 Association
coach, coder, consultant
36 years old
lives in Lübeck, Germany
credits to him for most of the slides
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. Kickstart
2. Action Controller
Controller
Repository View
Request
findByTitle('FLOW3')
Response
$book
assign('book', $book)
Response
Domain Model
render()
1
2
3
4
Book
Category Author
RoeBooks
Model-View-Controller
3. Templating
TEXT HERE
4. Models
TEXT HERE
TEXT HERE
TEXT HERE
5. 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; }}?>
TEXT HERE
6. Persistence
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
7. Resources
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
8. Dependency Injection
namespace Acme\Demo\Controller;
use TYPO3\FLOW3\Mvc\Controller\ActionController;use Acme\Demo\Service\GreeterService;
class DemoController extends ActionController { /** * @var \Acme\Demo\Service\GreeterServiceInterface * */ protected $greeterService;
/** * */ public function __construct() { $this->greeterService = new \Acme\Demo\Service\GreeterService(); } /** * @param string $name */ public function helloAction($name) { return $this->greeterService->greet($name); }
Without Dependency Injection
namespace Acme\Demo\Controller;
use TYPO3\FLOW3\Mvc\Controller\ActionController;use Acme\Demo\Service\GreeterService;
class DemoController extends ActionController { /** * @var \Acme\Demo\Service\GreeterServiceInterface * */ protected $greeterService;
/** * @param \Acme\Demo\Service\GreeterServiceInterface */ public function __construct(GreeterServiceInterface $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\GreeterServiceInterface * */ protected $greeterService;
/** * @param \Acme\Demo\Service\GreeterServiceInterface */ public function injectGreeterService(GreeterServiceInterface $greeterService) { $this->greeterService = $greeterService; } /** * @param string $name */ public function helloAction($name) { return $this->greeterService->greet($name); }
Setter Injection
namespace Acme\Demo\Controller;
use TYPO3\FLOW3\Annotations as FLOW3;use TYPO3\FLOW3\Mvc\Controller\ActionController;
class DemoController extends ActionController { /** * @var \Acme\Demo\Service\GreeterServiceInterface * @FLOW3\Inject */ protected $greeterService;
/** * @param string $name */ public function helloAction($name) { return $this->greeterService->greet($name); }
Property Injection
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 gathered automatically (autowiring)
• intuitive use and no bad magical surprises
• fast! (like hardcoded or faster)
9. Sessions
TEXT HERE
TEXT HERE
TEXT HERE
TEXT HERE
10. Security
TEXT HERE
TEXT HERE
11. Aspect-OrientedProgramming
12. In the wild
Rossmann
• second biggest drug store in Germany
• 5.13 billion ! turnover
• 31000 employees
Customer Database
Amadeus
• world’s biggest e-ticket provider
• 217 markets
• 948 million billable transactions / year
• 2.7 billion ! revenue
Social Media Suite
TEXT HERE
Thanks for having me!
Slides: http://slideshare.net/jocrau
Examples: https://github.com/jocrau/RoeBooks.Shop
Blog: http://typoplanet.com
Twitter: @jocrau @flow3
Feedback: [email protected] https://joind.in/6815
FLOW3: http://flow3.typo3.org