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

T3CON12DE: Four reasons you are going to love t...

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

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

christianjul

October 05, 2012
Tweet

More Decks by christianjul

Other Decks in Programming

Transcript

  1. 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
  2. Interoperability • PHP Framework Interoperability Group (PHP-FIG) •Basic Coding Standard

    (PSR-1) •Coding Style Guide (PSR-2) •Autoloading Standard (PSR-0)
  3. 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.
  4. 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
  5. shell> composer.phar require monolog/monolog Live demo - try this at

    home see code examples at https://gist.github.com/3844492
  6. Maintaining • Still everything in Git • Upgrading • get

    latest version of allowed dependencies • exact versions in .lock • Scriptable / deployable
  7. "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)
  8. "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
  9. "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
  10. Whats next? • Our own “Packagist” • Other asset types

    • Non PSR-0 packages • Integrate composer commands to CLI and Neos