Dependency management in PHP & ZendFramework 2
-
Upload
kirill-chebunin -
Category
Technology
-
view
4.776 -
download
4
Transcript of Dependency management in PHP & ZendFramework 2
Dependency PHP Management Zend Framework 2
Kirill chEbba ChebuninCreara
ZFConf 2012 (c) Kirill chEbba Chebunin
Actual PHP Problems
Code Quality Design Patterns
Standards PSR
Complete Solutions Libraries Modules, Bundles, Plugins Tools
ZFConf 2012 (c) Kirill chEbba Chebunin
Dependency Management
ZFConf 2012 (c) Kirill chEbba Chebunin
The Problem
ZFConf 2012 (c) Kirill chEbba Chebunin
The Problem
ZFConf 2012 (c) Kirill chEbba Chebunin
The Problem
ZFConf 2012 (c) Kirill chEbba Chebunin
Solutions
Python: easy_install, pip Ruby: gems Java: maven, ivy C#(.NET): NuGet, NuPack PHP: PEAR/Pyrus
ZFConf 2012 (c) Kirill chEbba Chebunin
Solutions. PHP Frameworks
Symfony2 Git Submodules bin/vendors Composer
Zend Framework2 Pyrus Modules?
ZFConf 2012 (c) Kirill chEbba Chebunin
Composer
ZFConf 2012 (c) Kirill chEbba Chebunin
Composer
PEAR. Why NOT? Composer. Why?
Created for Dependency management Separate storage & Package metadata Support existing infrastructure Dist & Source Extendable Autoload Support
ZFConf 2012 (c) Kirill chEbba Chebunin
Composer. Architecture
Package Repository – package meta data
Composer, Pear, VCS, etc Downloader
Archive, VCS, Pear Installer
Library, Project Autoload
PSR-0, ClassMap
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Pear
composer.json
"repositories": [ { "type": "pear", "url": "http://packages.zendframework.com" }]
ZFConf 2012 (c) Kirill chEbba Chebunin
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
ZF2 + Composer. Pear
public/index.php
//require_once //(getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library')// .'/Zend/Loader/AutoloaderFactory.php';//Zend\Loader\AutoloaderFactory::factory();
require_once 'vendor/.composer/autoload.php';
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Pear
/path/to/project$ composer install
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Pear
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Pear
Problems: Missed dependencies in zf2 channel Missed versions in zf2 channel No package groups support in Composer
Zend_Framework#Standard
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Composer
composer.json
"repositories": [ { "type": "composer", "url": "https://raw.github.com/chEbba/Zf2Composer/master"
}]
ZFConf 2012 (c) Kirill chEbba Chebunin
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
ZF2 + Composer. Composer
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Module
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Module
composer.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": "[email protected]", "homepage": "http://zendframework.com" } ],
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Module
composer.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": "[email protected]", "homepage": "http://zendframework.com" } ],
ZFConf 2012 (c) Kirill chEbba Chebunin
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
ZF2 + Composer. Modulehttp://packagist.org/packages/submit
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Module
composer.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
ZF2 + Composer. Module
application.config.php
'modules' => array(
'Application',
'ZendDeveloperTools'
)
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Pear
/path/to/project$ composer update
ZFConf 2012 (c) Kirill chEbba Chebunin
ZF2 + Composer. Composer
ZFConf 2012 (c) Kirill chEbba Chebunin
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
Questions?
Made by Coyl
Use Complete Solutions, BITCH!
Github: chEbba
Twitter: @iamchEbba
Mail: [email protected]