Diese Präsentation wurde erfolgreich gemeldet.

Dependency management in Magento with Composer

4

Teilen

Wird geladen in …3
×
1 von 17
1 von 17

Weitere Verwandte Inhalte

Ähnliche Bücher

Kostenlos mit einer 30-tägigen Testversion von Scribd

Alle anzeigen

Ähnliche Hörbücher

Kostenlos mit einer 30-tägigen Testversion von Scribd

Alle anzeigen

Dependency management in Magento with Composer

  1. 1. 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
  2. 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. 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": "git@github.com:AcmeCompany/FooLibrary.git" }, ] } $ composer install
  4. 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. 5. Benefits Time save Code reuse Code sharing Easy upgrades Same code usage
  6. 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. 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. 8. Magento Composer Installer by Magento Hackathon github.com/magento-hackathon/magento-composer-installer
  9. 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. 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. 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. 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. 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. 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. 15. Magento Composer Installer Useful extras… Deploy strategy (magento-deploystrategy) Auto append to gitignore (auto-append-gitignore) Mapping overwrite (magento-map-overwrite)
  16. 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
  17. 17. Thank you!

×