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.
7. 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
15. 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
16. Composer is De Facto Standard
Projects Drop PEAR Support
Magento 2 Dev Beta Release
Composer Adoption for Magento 2
2014
17. 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
18. 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/
/
19. 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
20. 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
23. 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
24. 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
25. 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
26. 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