SlideShare a Scribd company logo
Dependency 
management in 
Magento with 
Composer 
Manuele Menozzi 
Senior PHP Developer @ 
Webgriffe® 
Zend Certified PHP Engineer 
Proud & member 
Email: / Twitter: 
GrUSP PUG MoRe 
mmenozzi@webgriffe.com @mmenozzi
About Composer 
Composer is a tool for dependency management in PHP. It allows you to 
declare the dependent libraries your project needs and it will install 
them in your project for you.
What Composer does… 
/composer.json 
{ 
"require": { 
"psr/log": "~1.0", 
"acme/foo": "*", 
"monolog/monolog": "dev-master#2eb0c09" 
}, 
"require-dev": { 
"phpunit/phpunit": "~3.7.0" 
}, 
"repositories": [ 
{ 
"type": "vcs", 
"url": "git@github.com:AcmeCompany/FooLibrary.git" 
}, 
] 
} 
$ composer install
… and how 
composer install 
1. Available packages indexing 
2. Dependency tree and packages list calculation 
3. Packages list locking (composer.lock file) 
4. Packages download (in vendor folder) 
5. Custom installers 
6. Autoload dump
Benefits 
Time save 
Code reuse 
Code sharing 
Easy upgrades 
Same code usage
Composer & Magento 
The problem… 
Composer Magento 
./ 
├── htdocs/ 
└── vendor/ 
├── vendor-name-1/ 
│ ├── package-1/ 
│ ├── package-2/ 
│ └── package-n/ 
├── vendor-name-2/ 
└── vendor-name-n/ 
./ 
├── app/ 
│ ├── code/ 
│ │ ├── community/ 
│ │ └── local/ 
│ ├── design/ 
│ └── etc/ 
│ └── modules/ 
└── skin/
Composer & Magento 
The solution 
1. Available packages indexing 
2. Dependency tree and packages list calculation 
3. Packages list locking (composer.lock file) 
4. Packages download (in vendor folder) 
5. Custom installers 
6. Autoload dump
Magento Composer Installer 
by Magento Hackathon 
github.com/magento-hackathon/magento-composer-installer
Magento Composer Installer 
Install a module in your project 
./composer.json 
{ 
"require": { 
"foo/bar-module": "*", 
"magento-hackathon/magento-composer-installer": "*" 
}, 
"repositories": [ 
{ 
"type": "composer", 
"url": "http://packages.firegento.com" 
} 
], 
"extra":{ 
"magento-root-dir": "htdocs/" 
} 
} 
$ composer install
Magento Composer Installer 
Files mapping 
There are several ways how the mapping from files in the package into 
the Magento source is accomplished: 
1. A mapping in the composer.json 
2. The MagentoConnect package.xml file 
3. The modman file (see github.com/colinmollenhour/modman)
Magento Composer Installer 
Install a MagentoConnect module 
http://packages.firegento.com/ 
{ 
"require": { 
"connect20/locale_mage_community_it_it": "*" 
}, 
"repositories": [ 
{ 
"type": "composer", 
"url": "http://packages.firegento.com" 
} 
] 
}
Magento Composer Installer 
Install the Magento-Core and initialize your project 
Package magento/core on packages.firegento.com 
./composer.json 
{ 
"require": { 
"magento/core": "1.9.0.1" 
}, 
"repositories": [ 
{ 
"type": "composer", 
"url": "http://packages.firegento.com" 
} 
], 
"extra":{ 
"magento-root-dir": "htdocs/" 
} 
} 
Only 1.9.0.1 avaliable... :(
Magento Composer Installer 
Make a module installable with Composer 
./composer.json 
(important: "type": "magento-module") 
{ 
"name": "acme-company/module-name", 
"type": "magento-module", 
"license":"OSL-3.0", 
"description":"A short one line description of your module", 
"repositories": [ 
{ 
"type": "vcs", 
"url": "your/github/or/git/or/svn/etc/repository/uri" 
} 
], 
}
Magento Composer Installer 
Make a module installable with Composer 
Files mapping (modman example) 
./modman 
src app/code/local/AcmeCompany/ModuleName 
etc/AcmeCompany_ModuleName.xml app/etc/modules/ 
locale/it_IT/* app/locale/it_IT/ 
See github.com/colinmollenhour/modman for further info.
Magento Composer Installer 
Useful extras… 
Deploy strategy (magento-deploystrategy) 
Auto append to gitignore (auto-append-gitignore) 
Mapping overwrite (magento-map-overwrite)
Joind.in 
joind.in/talk/view/12698 
Any Question? 
Webgriffe 
Tailored Digital Works 
webgriffe.com | @webgriffe 
5+ Years of Experience with Magento 
5 Certified Developers (Zend & Magento) 
350+ Customers 
20+ Magento Extensions 
450+ Extensions Sold
Thank you!

More Related Content

What's hot (20)

PDF
WordPress mit Composer und Git verwalten
Walter Ebert
 
PDF
OpenCms Days 2015 Workflow using Docker and Jenkins
Alkacon Software GmbH & Co. KG
 
PDF
Symfony ile Gelişmiş API Mimarisi
Behram ÇELEN
 
PPTX
WordCamp Montreal 2016 WP-API + React with server rendering
Ziad Saab
 
PDF
OpenCms Days 2013 - Start rolling with OpenCms 9
Alkacon Software GmbH & Co. KG
 
PDF
Drupal 8 improvements for developer productivity php symfony and more
Acquia
 
PDF
Drupal + composer = new love !?
nuppla
 
PDF
Oleh Kobchenko - Configure Magento 2 to get maximum performance
Meet Magento Italy
 
ODP
Browser Exploitation Framework Tutorial
imlaurel2
 
PDF
KAK Etkinliği OJS de Symfony kullanımı
Behram Çelen
 
PPTX
Intro to Powershell
Dean Willson
 
PDF
Efficient development workflows with composer
nuppla
 
PDF
Efficient development workflows with composer
nuppla
 
PDF
OVERVIEW: Chromium Source Tree
Chang W. Doh
 
PDF
OpenCms Days 2014 - Updating to OpenCms 9.5
Alkacon Software GmbH & Co. KG
 
PDF
OpenCms Days 2015: Keynote - OpenCms 10 X marks the spot
OpenCms
 
PDF
Webpack: from 0 to 2
Alessandro Bellini
 
PDF
OpenCms Days 2013 - How to update smoothly to OpenCms 9ms 9
Alkacon Software GmbH & Co. KG
 
PDF
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
Alkacon Software GmbH & Co. KG
 
PPTX
Webpack
Raymond McDermott
 
WordPress mit Composer und Git verwalten
Walter Ebert
 
OpenCms Days 2015 Workflow using Docker and Jenkins
Alkacon Software GmbH & Co. KG
 
Symfony ile Gelişmiş API Mimarisi
Behram ÇELEN
 
WordCamp Montreal 2016 WP-API + React with server rendering
Ziad Saab
 
OpenCms Days 2013 - Start rolling with OpenCms 9
Alkacon Software GmbH & Co. KG
 
Drupal 8 improvements for developer productivity php symfony and more
Acquia
 
Drupal + composer = new love !?
nuppla
 
Oleh Kobchenko - Configure Magento 2 to get maximum performance
Meet Magento Italy
 
Browser Exploitation Framework Tutorial
imlaurel2
 
KAK Etkinliği OJS de Symfony kullanımı
Behram Çelen
 
Intro to Powershell
Dean Willson
 
Efficient development workflows with composer
nuppla
 
Efficient development workflows with composer
nuppla
 
OVERVIEW: Chromium Source Tree
Chang W. Doh
 
OpenCms Days 2014 - Updating to OpenCms 9.5
Alkacon Software GmbH & Co. KG
 
OpenCms Days 2015: Keynote - OpenCms 10 X marks the spot
OpenCms
 
Webpack: from 0 to 2
Alessandro Bellini
 
OpenCms Days 2013 - How to update smoothly to OpenCms 9ms 9
Alkacon Software GmbH & Co. KG
 
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
Alkacon Software GmbH & Co. KG
 

Similar to Dependency management in Magento with Composer (20)

PDF
Magento Fireside Chat: "Wiring Mageno Projects"
AOE
 
PPTX
PHP Dependency Management with Composer
Adam Englander
 
KEY
Composer
Tom Corrigan
 
PDF
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Meet Magento Italy
 
PDF
Composer & Drupal
drubb
 
PDF
Dependency management with Composer
Jason Grimes
 
PDF
Usage Note of SWIG for PHP
William Lee
 
PDF
Php Dependency Management with Composer ZendCon 2016
Clark Everetts
 
PDF
Browser Extensions for Web Hackers
Mark Wubben
 
PDF
Bower & Grunt - A practical workflow
Riccardo Coppola
 
PPT
Setting up the hyperledger composer in ubuntu
kesavan N B
 
PPTX
Composer namespacing
Deepak Chandani
 
PDF
Chrome Extensions for Web Hackers
Mark Wubben
 
PPTX
Orange is the new blue: How to port Chrome Extension to Firefox Extension
chaykaborya
 
PPTX
Composer
Arshad Ali
 
PDF
Php Dependency Management with Composer ZendCon 2017
Clark Everetts
 
PDF
MongoDB and Node.js
Norberto Leite
 
PPTX
Cordova iOS Native Plugin Development
Josue Bustos
 
PDF
Distributing UI Libraries: in a post Web-Component world
Rachael L Moore
 
Magento Fireside Chat: "Wiring Mageno Projects"
AOE
 
PHP Dependency Management with Composer
Adam Englander
 
Composer
Tom Corrigan
 
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Meet Magento Italy
 
Composer & Drupal
drubb
 
Dependency management with Composer
Jason Grimes
 
Usage Note of SWIG for PHP
William Lee
 
Php Dependency Management with Composer ZendCon 2016
Clark Everetts
 
Browser Extensions for Web Hackers
Mark Wubben
 
Bower & Grunt - A practical workflow
Riccardo Coppola
 
Setting up the hyperledger composer in ubuntu
kesavan N B
 
Composer namespacing
Deepak Chandani
 
Chrome Extensions for Web Hackers
Mark Wubben
 
Orange is the new blue: How to port Chrome Extension to Firefox Extension
chaykaborya
 
Composer
Arshad Ali
 
Php Dependency Management with Composer ZendCon 2017
Clark Everetts
 
MongoDB and Node.js
Norberto Leite
 
Cordova iOS Native Plugin Development
Josue Bustos
 
Distributing UI Libraries: in a post Web-Component world
Rachael L Moore
 
Ad

Recently uploaded (20)

PPTX
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
PDF
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
PPTX
一比一原版(LaTech毕业证)路易斯安那理工大学毕业证如何办理
Taqyea
 
PDF
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
PPTX
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PPTX
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
PDF
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
PPTX
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
PPTX
internet básico presentacion es una red global
70965857
 
PDF
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
PPTX
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
DOCX
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
PPTX
西班牙武康大学毕业证书{UCAMOfferUCAM成绩单水印}原版制作
Taqyea
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PPTX
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
PDF
Apple_Environmental_Progress_Report_2025.pdf
yiukwong
 
PDF
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
PPTX
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
一比一原版(LaTech毕业证)路易斯安那理工大学毕业证如何办理
Taqyea
 
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
internet básico presentacion es una red global
70965857
 
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
西班牙武康大学毕业证书{UCAMOfferUCAM成绩单水印}原版制作
Taqyea
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
Apple_Environmental_Progress_Report_2025.pdf
yiukwong
 
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
Ad

Dependency management in Magento with Composer

  • 1. Dependency management in Magento with Composer Manuele Menozzi Senior PHP Developer @ Webgriffe® Zend Certified PHP Engineer Proud & member Email: / Twitter: GrUSP PUG MoRe [email protected] @mmenozzi
  • 2. About Composer Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.
  • 3. What Composer does… /composer.json { "require": { "psr/log": "~1.0", "acme/foo": "*", "monolog/monolog": "dev-master#2eb0c09" }, "require-dev": { "phpunit/phpunit": "~3.7.0" }, "repositories": [ { "type": "vcs", "url": "[email protected]:AcmeCompany/FooLibrary.git" }, ] } $ composer install
  • 4. … and how composer install 1. Available packages indexing 2. Dependency tree and packages list calculation 3. Packages list locking (composer.lock file) 4. Packages download (in vendor folder) 5. Custom installers 6. Autoload dump
  • 5. Benefits Time save Code reuse Code sharing Easy upgrades Same code usage
  • 6. Composer & Magento The problem… Composer Magento ./ ├── htdocs/ └── vendor/ ├── vendor-name-1/ │ ├── package-1/ │ ├── package-2/ │ └── package-n/ ├── vendor-name-2/ └── vendor-name-n/ ./ ├── app/ │ ├── code/ │ │ ├── community/ │ │ └── local/ │ ├── design/ │ └── etc/ │ └── modules/ └── skin/
  • 7. Composer & Magento The solution 1. Available packages indexing 2. Dependency tree and packages list calculation 3. Packages list locking (composer.lock file) 4. Packages download (in vendor folder) 5. Custom installers 6. Autoload dump
  • 8. Magento Composer Installer by Magento Hackathon github.com/magento-hackathon/magento-composer-installer
  • 9. Magento Composer Installer Install a module in your project ./composer.json { "require": { "foo/bar-module": "*", "magento-hackathon/magento-composer-installer": "*" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ], "extra":{ "magento-root-dir": "htdocs/" } } $ composer install
  • 10. Magento Composer Installer Files mapping There are several ways how the mapping from files in the package into the Magento source is accomplished: 1. A mapping in the composer.json 2. The MagentoConnect package.xml file 3. The modman file (see github.com/colinmollenhour/modman)
  • 11. Magento Composer Installer Install a MagentoConnect module http://packages.firegento.com/ { "require": { "connect20/locale_mage_community_it_it": "*" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ] }
  • 12. Magento Composer Installer Install the Magento-Core and initialize your project Package magento/core on packages.firegento.com ./composer.json { "require": { "magento/core": "1.9.0.1" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ], "extra":{ "magento-root-dir": "htdocs/" } } Only 1.9.0.1 avaliable... :(
  • 13. Magento Composer Installer Make a module installable with Composer ./composer.json (important: "type": "magento-module") { "name": "acme-company/module-name", "type": "magento-module", "license":"OSL-3.0", "description":"A short one line description of your module", "repositories": [ { "type": "vcs", "url": "your/github/or/git/or/svn/etc/repository/uri" } ], }
  • 14. Magento Composer Installer Make a module installable with Composer Files mapping (modman example) ./modman src app/code/local/AcmeCompany/ModuleName etc/AcmeCompany_ModuleName.xml app/etc/modules/ locale/it_IT/* app/locale/it_IT/ See github.com/colinmollenhour/modman for further info.
  • 15. Magento Composer Installer Useful extras… Deploy strategy (magento-deploystrategy) Auto append to gitignore (auto-append-gitignore) Mapping overwrite (magento-map-overwrite)
  • 16. Joind.in joind.in/talk/view/12698 Any Question? Webgriffe Tailored Digital Works webgriffe.com | @webgriffe 5+ Years of Experience with Magento 5 Certified Developers (Zend & Magento) 350+ Customers 20+ Magento Extensions 450+ Extensions Sold