Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Sergii Shymko: Magento 2: Composer for Extensions Distribution

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Wird geladen in …3
×

Hier ansehen

1 von 30 Anzeige

Sergii Shymko: Magento 2: Composer for Extensions Distribution

Herunterladen, um offline zu lesen

Magento 1.x uses Magento Connect to package and distribute extensions. Magento 2 uses Composer, a de facto standard dependency manager for PHP, instead. Integration with Composer changes approach to module versioning, dependencies declaration, and installation. It completely changes the way modules/themes/localizations are distributed in the Magento ecosystem.

Magento 1.x uses Magento Connect to package and distribute extensions. Magento 2 uses Composer, a de facto standard dependency manager for PHP, instead. Integration with Composer changes approach to module versioning, dependencies declaration, and installation. It completely changes the way modules/themes/localizations are distributed in the Magento ecosystem.

Anzeige
Anzeige

Weitere Verwandte Inhalte

Diashows für Sie (20)

Ähnlich wie Sergii Shymko: Magento 2: Composer for Extensions Distribution (20)

Anzeige

Weitere von Meet Magento Italy (20)

Aktuellste (20)

Anzeige

Sergii Shymko: Magento 2: Composer for Extensions Distribution

  1. 1. The Dependency Management Problem • App consists of many components • Dependencies between components • Optional components • Compatibility of components • Unique components per project • Components management: – Install – Uninstall – Update
  2. 2. No Dependency Manager / PEAR First Magento CE Release! 2008
  3. 3. What’s Up with PEAR? • PEAR – PHP Extension and Application Repository • System-wide installation • Strict package structure • Bureaucracy • PEAR channel hosting • Dependency issues • Usability issues
  4. 4. Magento 1.x Package Management • Monolith release package • • Magento Connect Manager: – Homegrown packaging format – GUI for management • PEAR for CLI management • Vague module versioning • Not versioned dependencies Magento 1.x release package Feature Modules Magento libraries 3rd party libraries Design themes/skins Localizations
  5. 5. Still No Dependency Manager Module Manager “modman” 2010
  6. 6. Modman for Magento 1.x • Modman – command line tool • Keeps extensions separately from Magento • Alternative packaging format • CLI for management • Use cases: – Development – Deployment Magento 1.x module package Community module modman
  7. 7. First Composer Release! First Composer Use for Magento 1.x Magento 2 Development in Progress 2012
  8. 8. Composer Overview • Composer – dependency manager for PHP • Composer – CLI tool • Dependencies per project • Versioned dependencies • Package management: – Install – Uninstall – Update • Classes autoloading
  9. 9. Composer Basic Usage 1. Declaring project dependencies composer.json 1. Installing dependencies php composer.phar install 1. Autoloading dependencies require 'vendor/autoload.php'; vendor/ autoload.php Zend/… … my_project/ composer.json
  10. 10. Installation via Composer 1. Read composer.json 1. Read required packages 2. Read repositories 3. Append packagist.org to repositories 2. For each package: 1. Download from repository 2. Install dependencies recursively 3. Register plugin, if API implemented
  11. 11. Composer Adoption for Magento 1.x • Composer plugin for Magento 1.x magento-hackathon/magento-composer-installer • Deployment strategies: – Copy – Move – Symlink • Modman packages support • Composer packages repository packages.firegento.com
  12. 12. Magento 1.x Composer Package Example { "name": "aoepeople/Aoe_Scheduler", "type": "magento-module", "description": "Magento Cron Scheduler", "require": { "magento-hackathon/magento-composer-installer": "*" } } composer.json
  13. 13. Magento 1.x Composer Project Example { "require": { "magento/core": "1.9.0.1", "aoepeople/Aoe_Scheduler": "*", "magento-hackathon/magento-composer-installer": "*" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ] } composer.json
  14. 14. Composer Adoption Obstacles in 1.x • Monolith CE Composer package • No strict versioning • No module API version • No theme version • No locale version • Files not in one directory: – Module files – Theme & skin files magento/core 1.9.0.1 Feature Modules Magento libraries 3rd party libraries Design themes/skins Localizations composer.json
  15. 15. Composer is De Facto Standard Projects Drop PEAR Support Magento 2 Dev Beta Release Composer Adoption for Magento 2 2014
  16. 16. Composer Adoption in Magento 2 • Prerequisites: – Self-contained modules – Self-contained themes • Monolith Granular core packages • Fork of the Composer plugin for 1.x magento/magento-composer-installer • Composer packages repository packages.magento.com
  17. 17. Composer Package Types in Magento 2 • Package type defines files destination • Implemented by the Composer plugin • Custom package types: magento2-module magento2-theme magento2-language magento2-library magento2-component app/code/ app/design/ app/i18n/ lib/internal/ /
  18. 18. Composer Packages in Magento 2 magento/module-catalog composer.json Module magento/theme-frontend-luma composer.json Theme monolog/monolog composer.json 3rd party library magento/language-it_it composer.json Localization
  19. 19. Composer Packages in Magento 2 magento/zendframework1 composer.json 3rd party library fork magento/magento2-base composer.json Application skeleton magento/framework composer.json Framework
  20. 20. Magento 2 Module Package Example { "name": "magento/module-catalog", "require": { "php": "~5.5.0|~5.6.0", "magento/module-store": "0.42.0-beta9", "magento/framework": "0.42.0-beta9", "magento/magento-composer-installer": "*" }, "type": "magento2-module", "version": "0.42.0-beta9", "extra": { "map": [ ["*", "Magento/Catalog"] ] } } composer.json app/code/ Magento/Catalog/
  21. 21. Core Changes for Composer Adoption
  22. 22. Module Versioning in Magento 2 • Composer requires semantic versioning semver.org • Adoption of Semantic Version 2.0.0 <major>.<minor>.<patch>[-<suffix>] <major> – Incompatible API changes <minor> – Add functionality in BC manner <patch> – BC bug fixes <suffix> – Stability
  23. 23. Module Version Declaration Magento 1.x module config.xml etc/ Version, not semantic DB schema version API version, semantic Magento 2 module package module.xml etc/ composer.json
  24. 24. Module Dependencies Declaration Magento 1.x module config.xml etc/ Magento 2 module package module.xml etc/ composer.json Dependencies ordered, not versioned Dependencies not ordered, versioned Modules order
  25. 25. Magento 2 Repositories github.com magento/magento2 – CE mainline magento/magento2-community-edition – CE Composer project magento/magento-composer-installer – Composer plugin magento/zf1 – Fork of Zend Framework 1.x
  26. 26. Results of Composer Adoption • Granular core packages • Semantic versioning • Versioned dependencies • Theme dependencies • Locale dependencies • Validation of environment – PHP version – PHP libraries
  27. 27. Resources • Magento 2 – devdocs.magento.com – Developer documentation – github.com/magento/magento2 – CE mainline repository – github.com/magento/magento2-community-edition – CE Composer project – github.com/magento/magento-composer-installer – Composer plugin – packages.magento.com – Composer packages repository • Magento 1.x – github.com/magento-hackathon/magento-composer-installer – Composer plugin – packages.firegento.com – Composer packages repository • Composer – getcomposer.org – Composer tool – packagist.org – Composer packages repository – semver.org – Semantic versioning
  28. 28. Q: When is Magento 2 Release? A: Magento 2 release schedule: 1. Q4 2014 – Dev Beta  Released Dec 17, 2014 2. Q1 2015 – Dev RC 3. Q3 2015 – Merchant Beta 4. Q4 2015 – Merchant GA
  29. 29. Thank You! Q & A Sergii Shymko sergey@shymko.net

Hinweis der Redaktion

  • Magento Community Edition 1.? Release
  • PEAR – framework & distribution system
    PEAR – reusable general-purpose libraries
    System-wide installation by default
  • Semantic package versioning
  • Directory ‘vendor’
  • Call Composer plugin API, if implemented by a package
  • Plugin developed by community at Magento bugathon
    Plugin is published at Packagist
  • Not semantic module versioning
    DB schema version, but no module API version
    Single Composer package for CE release
  • Doctrine, Symfony2, PHPUnit drop PEAR support
  • Self-contained modules/themes – all files in one directory
    Forked the hackathon Composer plugin for Magento 1.x to adopt for Magento 2
  • Forked the hackathon Composer plugin for Magento 1.x to adopt for Magento 2
  • Forked the hackathon Composer plugin for Magento 1.x to adopt for Magento 2
  • BC – backward-compatibility
    <suffix> – dev, patch/p, alpha/a, beta/b, RC
  • PHP library dependencies, such as Imagemagic, Mcrypt, etc.
    Theme dependencies on 3rd party libs, such as Angular.js, jQuery carousel, etc.
  • RC – Release Candidate
    GA – General Availability

×