Dependency management in PHP & ZendFramework 2

5,442 views
5,332 views

Published on

Talk about dependency management in PHP and ZendFramework2. Use Composer with ZF2 project.
Created for ZfConf 2012 Russia. http://www.zfconf.ru/2012/

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

No Downloads
Views
Total views
5,442
On SlideShare
0
From Embeds
0
Number of Embeds
733
Actions
Shares
0
Downloads
60
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Dependency management in PHP & ZendFramework 2

  1. 1. Dependency PHPManagement Zend Framework 2 Kirill chEbba Chebunin Creara
  2. 2. Actual PHP Problems  Code Quality − Design Patterns  Standards − PSR  Complete Solutions − Libraries − Modules, Bundles, Plugins − ToolsZFConf 2012 (c) Kirill chEbba Chebunin
  3. 3. Dependency ManagementZFConf 2012 (c) Kirill chEbba Chebunin
  4. 4. The ProblemZFConf 2012 (c) Kirill chEbba Chebunin
  5. 5. The ProblemZFConf 2012 (c) Kirill chEbba Chebunin
  6. 6. The ProblemZFConf 2012 (c) Kirill chEbba Chebunin
  7. 7. Solutions  Python: easy_install, pip  Ruby: gems  Java: maven, ivy  C#(.NET): NuGet, NuPack  PHP: PEAR/PyrusZFConf 2012 (c) Kirill chEbba Chebunin
  8. 8. Solutions. PHP Frameworks  Symfony2 − Git Submodules − bin/vendors − Composer  Zend Framework2 − Pyrus − Modules?ZFConf 2012 (c) Kirill chEbba Chebunin
  9. 9. ComposerZFConf 2012 (c) Kirill chEbba Chebunin
  10. 10. Composer  PEAR. Why NOT?  Composer. Why? − Created for Dependency management − Separate storage & Package metadata − Support existing infrastructure − Dist & Source − Extendable − Autoload SupportZFConf 2012 (c) Kirill chEbba Chebunin
  11. 11. Composer. Architecture  Package  Repository – package meta data − Composer, Pear, VCS, etc  Downloader − Archive, VCS, Pear  Installer − Library, Project  Autoload − PSR-0, ClassMapZFConf 2012 (c) Kirill chEbba Chebunin
  12. 12. ZF2 + ComposerZFConf 2012 (c) Kirill chEbba Chebunin
  13. 13. ZF2 + Composer. Pear composer.json "repositories": [ { "type": "pear", "url": "http://packages.zendframework.com" } ]ZFConf 2012 (c) Kirill chEbba Chebunin
  14. 14. ZF2 + Composer. Pear "require": { "php": ">=5.3.2", "pear-zf2/Zend_Mvc": "2.0.0beta3", "pear-zf2/Zend_Di": "2.0.0beta3", "pear-zf2/Zend_Code": "2.0.0beta3", "pear-zf2/Zend_Config": "2.0.0beta3", "pear-zf2/Zend_EventManager": "2.0.0beta3", "pear-zf2/Zend_Filter": "2.0.0beta3", "pear-zf2/Zend_Http": "2.0.0beta3", "pear-zf2/Zend_Loader": "2.0.0beta3", "pear-zf2/Zend_Module": "2.0.0beta3", "pear-zf2/Zend_Registry": "2.0.0beta3", "pear-zf2/Zend_Stdlib": "2.0.0beta3", "pear-zf2/Zend_Uri": "2.0.0beta3", "pear-zf2/Zend_Validator": "2.0.0beta3", "pear-zf2/Zend_View": "2.0.0beta3" }ZFConf 2012 (c) Kirill chEbba Chebunin
  15. 15. ZF2 + Composer. Pear public/index.php //require_once //(getenv(ZF2_PATH) ?: vendor/ZendFramework/library) // ./Zend/Loader/AutoloaderFactory.php; //ZendLoaderAutoloaderFactory::factory(); require_once vendor/.composer/autoload.php;ZFConf 2012 (c) Kirill chEbba Chebunin
  16. 16. ZF2 + Composer. Pear /path/to/project$ composer installZFConf 2012 (c) Kirill chEbba Chebunin
  17. 17. ZF2 + Composer. PearZFConf 2012 (c) Kirill chEbba Chebunin
  18. 18. ZF2 + Composer. Pear Problems:  Missed dependencies in zf2 channel  Missed versions in zf2 channel  No package groups support in Composer Zend_Framework#StandardZFConf 2012 (c) Kirill chEbba Chebunin
  19. 19. ZF2 + Composer. Composercomposer.json"repositories": [ { "type": "composer", "url": "https://raw.github.com/chEbba/Zf2Composer/master" }]ZFConf 2012 (c) Kirill chEbba Chebunin
  20. 20. ZF2 + Composer. Composer "require": { "php": ">=5.3.2", "pear-zf2/Zend_Mvc": "2.0.0beta3", "pear-zf2/Zend_EventManager": "2.0.0beta3", "pear-zf2/Zend_Module": "2.0.0beta3", "pear-zf2/Zend_View": "2.0.0beta3" }ZFConf 2012 (c) Kirill chEbba Chebunin
  21. 21. ZF2 + Composer. ComposerZFConf 2012 (c) Kirill chEbba Chebunin
  22. 22. ZF2 + Composer. ModuleZFConf 2012 (c) Kirill chEbba Chebunin
  23. 23. ZF2 + Composer. Modulecomposer.json "name": "zendframework/zend-developer-tools", "description": "ZF2 module for developer and debug tools.", "keywords": ["zend", "zf", "module", "developer", "tools"], "homepage": "https://github.com/zendframework/ZendDeveloperTools", "type": "library", "license": "New BSD License", "authors": [ { "name": "Zend Technologies USA", "email": "info@zendframework.com", "homepage": "http://zendframework.com" } ],ZFConf 2012 (c) Kirill chEbba Chebunin
  24. 24. ZF2 + Composer. Modulecomposer.json "name": "zendframework/zend-developer-tools", "description": "ZF2 module for developer and debug tools.", "keywords": ["zend", "zf", "module", "developer", "tools"], "homepage": "https://github.com/zendframework/ZendDeveloperTools", "type": "library", "license": "New BSD License", "authors": [ { "name": "Zend Technologies USA", "email": "info@zendframework.com", "homepage": "http://zendframework.com" } ],ZFConf 2012 (c) Kirill chEbba Chebunin
  25. 25. ZF2 + Composer. Module "version": "1.0.0-pr1", "require":{ "php":">=5.3.2", "pear-zf2/zend_mvc": "2.0.0beta3", "pear-zf2/zend_eventmanager": "2.0.0beta3", "pear-zf2/zend_http": "2.0.0beta3", "pear-zf2/zend_stdlib": "2.0.0beta3", "pear-zf2/zend_view": "2.0.0beta3" }, "autoload":{ "classmap":[""] }ZFConf 2012 (c) Kirill chEbba Chebunin
  26. 26. ZF2 + Composer. Modulehttp://packagist.org/packages/submitZFConf 2012 (c) Kirill chEbba Chebunin
  27. 27. ZF2 + Composer. Modulecomposer.json"require": { "php": ">=5.3.2", "pear-zf2/Zend_Mvc": "2.0.0beta3", "pear-zf2/Zend_EventManager": "2.0.0beta3", "pear-zf2/Zend_Module": "2.0.0beta3", "pear-zf2/Zend_View": "2.0.0beta3", "zendframework/zend_developer_tools": "1.0.0-alpha1"}ZFConf 2012 (c) Kirill chEbba Chebunin
  28. 28. ZF2 + Composer. Moduleapplication.config.php modules => array( Application, ZendDeveloperTools )ZFConf 2012 (c) Kirill chEbba Chebunin
  29. 29. ZF2 + Composer. Pear /path/to/project$ composer updateZFConf 2012 (c) Kirill chEbba Chebunin
  30. 30. ZF2 + Composer. ComposerZFConf 2012 (c) Kirill chEbba Chebunin
  31. 31. Links  https://github.com/chEbba/Zf2Composer/  https://github.com/zendframework/ZendSkeletonApplication/  https://github.com/zendframework/ZendDeveloperTools/  https://github.com/stefankleff/ZendDeveloperTools/  http://getcomposer.org/  http://packagist.org/  http://packages.zendframework.com/  http://modules.zendframework.com/ZFConf 2012 (c) Kirill chEbba Chebunin
  32. 32. Questions? Use Complete Solutions, BITCH! Github: chEbba Twitter: @iamchEbba Mail: iam@chebba.org Made by CoylZFConf 2012 (c) Kirill chEbba Chebunin

×