Fluent Development with FLOW3

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Group

    Fluent Development with FLOW3 - Presentation Transcript

    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
    6. <?php
    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 Model\\Customer; ! ! $customer->setFirstName($_POST['firstname']); ! ! $customer->setLastName($_POST['lastname']); ! ! ! ! $customerValidator = MyApp\\Validators\\CustomerValidator::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 Model\\Customer; ! ! $customer->setFirstName($_POST['firstname']); ! ! $customer->setLastName($_POST['lastname']); ! ! ! ! $customerValidator = MyApp\\Validators\\CustomerValidator::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 Domain\\Model\\Customer(); ! ! $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 F3\\MyPackage\\Controller; class DefaultController extends F3\\FLOW3\\MVC\\Controller\\ActionController { ! 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 F3\\FLOW3(); $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 F3\\FLOW3('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

    + Robert LemkeRobert Lemke, 2 years ago

    custom

    2592 views, 0 favs, 3 embeds more stats

    FLOW3 is a modern web application framework for PHP more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 2592
      • 1359 on SlideShare
      • 1233 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 50
    Most viewed embeds
    • 1230 views on http://flow3.typo3.org
    • 2 views on http://wiki.assai.ch
    • 1 views on http://bertrandkeller.info

    more

    All embeds
    • 1230 views on http://flow3.typo3.org
    • 2 views on http://wiki.assai.ch
    • 1 views on http://bertrandkeller.info

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Groups / Events