magento with composer
DESCRIPTION
San Francisco Magento Meetup 2014/04TRANSCRIPT
Composer Magento with
Fabrizio Branca (@fbrnc) - San Francisco Magento Meetup – April 7, 2014
the problem Intro
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
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
Magento 2
pub
Module
code
My
app
Magento
My_Module
My_Module2
view
Controller
etc
i18n
Block
…
Module2
view
Controller
etc
i18n
Block
…
Magento 2
the requirements Intro
• 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
a solution Intro
modman
by @colinmollenhour
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
“wiring” Intro
modman “connects” existing modules to the Magento core, but how do we manage them?
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
svn:externals
Git submodules
Phing/Ant
Custom scripts
Composer
Components Options
works fine, but needs some getting used to it
Composer Intro
in a nutshell…
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
Fabrizio’s lightweight approach
Approach
@fbrnc
Keeping it Simple!
AOEpeople/composer-installers "replace": { "magento-hackathon/magento-composer-installer":"*" }
“inspired” by composer/installers
“magento-module” “magento-source”
handles package types
<?php namespace Aoepeople\ComposerInstallers; class MagentoInstaller extends BaseInstaller { protected $locations = array( 'module' => '.modman/{$name}/', 'source' => 'htdocs/' ); }
AOEpeople/composer-installers
• 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
{ "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,…
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
https://github.com/AOEpeople/Magento_SampleProject
Thank you! Any questions?