Download - Magento with Composer
![Page 1: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/1.jpg)
Composer Magento with
Fabrizio Branca (@fbrnc) - San Francisco Magento Meetup – April 7, 2014
![Page 2: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/2.jpg)
the problem Intro
![Page 3: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/3.jpg)
htdocs
<Name>
<theme>
layout
template
code
design
etc
locale
<area>
core
community
local
<area>
<language>
modules
<package>
<Namespace>
<package>
*.xml
*.csv
<theme>
app
skin
lib
Module2
default
layout
template
code
design
etc
locale
frontend
local
frontend
de_DE
modules
base
My
base
My_Module2.xml
My_Module2.csv
default
app
skin
etc, Block, …
js, css, img, …
my_module2
my_module2
Magento My_Module My_Module2
Module
default
layout
template
code
design
etc
locale
frontend
local
frontend
de_DE
modules
base
My
base
My_Module.xml
My_Module.csv
default
app
skin
etc, Block, …
js, css, img, …
my_module
my_module
![Page 4: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/4.jpg)
htdocs
Module
default
layout
template
code
design
etc
locale
local
frontend
de_DE
modules
My
base
*.xml
app
My_Module2.xml
My_Module2.csv
my_module2
My_Module.xml
My_Module.csv
etc, Block, …
my_module
Module2
etc, Block, …
my_module2
my_module
![Page 5: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/5.jpg)
Magento 2
![Page 6: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/6.jpg)
![Page 7: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/7.jpg)
pub
Module
code
My
app
Magento
My_Module
My_Module2
view
Controller
etc
i18n
Block
…
Module2
view
Controller
etc
i18n
Block
…
Magento 2
![Page 8: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/8.jpg)
the requirements Intro
![Page 9: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/9.jpg)
• Reuse modules
• Share modules
• Easy and clean uninstall without leftovers
• Non-destructive (no deletion of files)
• Clean Magento vanilla code
• Work collaboratively on projects
• Restrict access to modules for team members
• Independent versioning scheme of modules
• Independent version control origin
the requirements
![Page 10: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/10.jpg)
a solution Intro
![Page 11: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/11.jpg)
modman
by @colinmollenhour
![Page 12: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/12.jpg)
htdocs
code
core
community
local
app
app/code/…/My/Module
.modman
My_Module
app/design/…
skin/frontend/…
app/etc/modules/My_Module.xml
modman
app/code/…/My/Module
My_Module2
app/design/…
skin/frontend/…
app/etc/modules/My_Module.xml
modman
<theme>
layout
template
design
etc
locale
<area>
<area>
<language>
modules
<package>
<package>
*.xml
*.csv
<theme>
skin
modman
![Page 13: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/13.jpg)
“wiring” Intro
modman “connects” existing modules to the Magento core, but how do we manage them?
![Page 14: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/14.jpg)
htdocs
code
core
community
local
app
app/code/…/My/Module
.modman
My_Module
app/design/…
skin/frontend/…
app/etc/modules/My_Module.xml
modman
app/code/…/My/Module
My_Module2
app/design/…
skin/frontend/…
app/etc/modules/My_Module.xml
modman
<theme>
layout
template
design
etc
locale
<area>
<area>
<language>
modules
<package>
<package>
*.xml
*.csv
<theme>
skin
Components
tools
n98-magerun.phar
phpunit.phar
modman
EnvSettingsTool
composer.phar
htdocs
.modman
Configuration
Installer
(Metadata, Doc,…)
My_Module
My_Module2
app,…
and usually there’s even more stuff…
These should come from different origins
![Page 15: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/15.jpg)
svn:externals
Git submodules
Phing/Ant
Custom scripts
Composer
Components Options
works fine, but needs some getting used to it
![Page 16: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/16.jpg)
Composer Intro
in a nutshell…
![Page 17: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/17.jpg)
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.”
phar file
json configuration
supports Git, SVN, tar,… and mix’n’match
package management
Dependency management (including fine-grained
control over specific versions,…)
Autoloader
![Page 18: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/18.jpg)
Fabrizio’s lightweight approach
Approach
@fbrnc
![Page 19: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/19.jpg)
Keeping it Simple!
![Page 20: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/20.jpg)
AOEpeople/composer-installers "replace": { "magento-hackathon/magento-composer-installer":"*" }
“inspired” by composer/installers
“magento-module” “magento-source”
handles package types
![Page 21: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/21.jpg)
<?php namespace Aoepeople\ComposerInstallers; class MagentoInstaller extends BaseInstaller { protected $locations = array( 'module' => '.modman/{$name}/', 'source' => 'htdocs/' ); }
AOEpeople/composer-installers
![Page 22: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/22.jpg)
• Fully compatible with magento-hackathon/magento-composer-installer
• Adds support for type “magento-source”
• Only puts packages into place
• Native modman script is used to deploy modules
• Wrapped in a simple installer script
AOEpeople/composer-installers
![Page 23: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/23.jpg)
{ "minimum-stability":"dev", "require":{ "aoepeople/composer-installers": "*", "fbrnc/aoe_scheduler": "*", "fbrnc/aoe_cachecleaner": "*", "aoemedia/magento_enterprise": "1.13.1.0", "aoemedia/envsettingstool": "*" }, "config": { "bin-dir": "bin" } }
AOEpeople/composer-installers replaces
Hackathon Installer
some modules
Vanilla Magento Source
Tools,…
![Page 24: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/24.jpg)
htdocs
code
core
community
local
app
app/code/…/My/Module
.modman
My_Module
app/design/…
skin/frontend/…
app/etc/modules/My_Module.xml
modman
app/code/…/My/Module
My_Module2
app/design/…
skin/frontend/…
app/etc/modules/My_Module.xml
modman
<theme>
layout
template
design
etc
locale
<area>
<area>
<language>
modules
<package>
<package>
*.xml
*.csv
<theme>
skin
Components
![Page 25: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/25.jpg)
https://github.com/AOEpeople/Magento_SampleProject
![Page 26: Magento with Composer](https://reader033.vdocument.in/reader033/viewer/2022052504/554a3fc4b4c90582328b5099/html5/thumbnails/26.jpg)
Thank you! Any questions?