Magento with Composer

1,026
-1

Published on

San Francisco Magento Meetup 2014/04

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,026
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
21
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Magento with Composer

  1. 1. Composer Magento with Fabrizio Branca (@fbrnc) - San Francisco Magento Meetup – April 7, 2014
  2. 2. the problem Intro
  3. 3. 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
  4. 4. 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
  5. 5. Magento 2
  6. 6. pub Module code My app Magento My_Module My_Module2 view Controller etc i18n Block … Module2 view Controller etc i18n Block … Magento 2
  7. 7. the requirements Intro
  8. 8. • 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
  9. 9. a solution Intro
  10. 10. modman by @colinmollenhour
  11. 11. 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> <language> modules <package> *.xml modman
  12. 12. “wiring” Intro modman “connects” existing modules to the Magento core, but how do we manage them?
  13. 13. 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> <language> modules <package> *.xml 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
  14. 14. svn:externals Git submodules Phing/Ant Custom scripts Composer Components Options works fine, but needs some getting used to it
  15. 15. Composer Intro in a nutshell…
  16. 16. 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
  17. 17. Fabrizio’s lightweightapproach Approach @fbrnc
  18. 18. Keeping it Simple!
  19. 19. AOEpeople/composer-installers "replace": { "magento-hackathon/magento-composer-installer":"*" } “inspired” by composer/installers “magento-module” “magento-source” handles package types
  20. 20. <?php namespace AoepeopleComposerInstallers; class MagentoInstaller extends BaseInstaller { protected $locations = array( 'module' => '.modman/{$name}/', 'source' => 'htdocs/' ); } AOEpeople/composer-installers
  21. 21. • 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
  22. 22. { "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,…
  23. 23. 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> <language> modules <package> *.xml Components
  24. 24. https://github.com/AOEpeople/Magento_SampleProject
  25. 25. Thank you! Any questions?

×