Upgrade to Pro — share decks privately, control downloads, hide ads and more …

T3CON12DE: Four reasons you are going to love the new package management

T3CON12DE: Four reasons you are going to love the new package management

Introduction to how TYPO3 Flow and Neos uses Composer for package management



October 05, 2012

More Decks by christianjul

Other Decks in Programming


  1. Package management in Phoenix and FLOW3 Christian Jul Jensen

  2. Package management in TYPO3 Neos and Flow Christian Jul Jensen

  3. Four reasons you are going to love the new package

    management Julle
  4. Once upon a time

  5. Once upon a time

  6. and then came …

  7. Easy sharing and distributing of components is a key success

    factor for any system
  8. 1: Installation

  9. let’s do this!

  10. shell> composer.phar create-project --repository-url="http:// jul.net" typo3/flow-base-distribution TYPO3-Flow shell> cd TYPO3-Flow/

    shell> ./flow help shell> composer.phar require typo3/typoscript Live demo - try this at home
  11. 2: Strange code Or: Using 3rd party components

  12. Interoperability • PHP Framework Interoperability Group (PHP-FIG) •Basic Coding Standard

    (PSR-1) •Coding Style Guide (PSR-2) •Autoloading Standard (PSR-0)
  13. PSR-0 Autoloading Standard • A fully-qualified namespace and class must

    have the following structure \<Vendor Name>\(<Namespace>\)*<Class Name> • Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system. • Each "_" character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace. • The fully-qualified namespace and class is suffixed with ".php" when loading from the file system. • Alphabetic characters in vendor names, namespaces, and class names may be of any combination of lower case and upper case.
  14. PSR-0 Autoloading Standard • Vendorname: TYPO3 • Namespace: Flow, Neos,

    Fluid \TYPO3\Flow\Package\PackageManager => …/TYPO3/Flow/Package/PackageManager.php \Symfony\Component\Yaml\Parser => …/Symfony/Component/Yaml/Parser.php
  15. Humongous amounts of great code available right at your fingertips!

  16. let’s do some more!

  17. shell> composer.phar require monolog/monolog Live demo - try this at

    home see code examples at https://gist.github.com/3844492
  18. 3: Maintaining

  19. Maintaining • Still everything in Git • Upgrading • get

    latest version of allowed dependencies • exact versions in .lock • Scriptable / deployable
  20. 4: Sharing

  21. composer.json Classes/ TYPO3/ Kickstart/ Meta/ License.txt Resources/ Private Tests/ Unit

    Package structure
  22. "name": "typo3/kickstart", "type": "typo3-flow-framework", "description": "A simple generator for controller

    and views.", "license": "LGPL-3.0+", "version": "1.2.0-dev", "require": { "typo3/flow": "*" }, "autoload": { "psr-0": { "TYPO3\\Kickstart": "Classes" } } The composer manifest (composer.json)
  23. "name": "typo3/phoenix-base-distribution", "description" : "Phoenix Base Distribution", "license": "GPL-3.0+", "repositories":

    [ { "type": "composer", "url": "http://ci.typo3.robertlemke.net/job/composer-packages/ws/repository/" } ], "config": { "vendor-dir": "Packages/Vendor", "bin-dir": "bin" }, "require": { "typo3/phoenix": "dev-master", "typo3/phoenixdemotypo3org": "dev-master" }, "require-dev": { "typo3/buildessentials": "dev-master", "mikey179/vfsstream": "1.1.*" }, "minimum-stability": "dev", "scripts": { "post-update-cmd": "TYPO3\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall", "post-install-cmd": "TYPO3\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall" } Distributions
  24. "name": "typo3/phoenix-base-distribution", "description" : "Phoenix Base Distribution", "config": { "vendor-dir":

    "Packages/Vendor", "bin-dir": "bin" }, "require": { "typo3/phoenix": "dev-master", "typo3/phoenixdemotypo3org": "dev-master" }, "require-dev": { "typo3/buildessentials": "dev-master", "mikey179/vfsstream": "1.1.*" }, "scripts": { "post-update-cmd": "TYPO3\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall", "post-install-cmd": "TYPO3\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall" } Distributions
  25. Whats next? • Our own “Packagist” • Other asset types

    • Non PSR-0 packages • Integrate composer commands to CLI and Neos
  26. Anything else you would like to know? Thanks for staying