Composer the Right Way - PHPBNL16

0 %
100 %
Information about Composer the Right Way - PHPBNL16

Published on January 30, 2016

Author: rdohms

Source: slideshare.net

1. Composer the right way @rdohms Rafael Dohms

2. photo: smileymanwithahat

3. photo: Rob Allen

4. photo: 18millionpixels

5. Library Publisher photo: 18millionpixels

6. Library Publisher Library Consumer photo: 18millionpixels

7. Library Publisher Library Library Consumer photo: 18millionpixels

8. Library Publisher Library Library Consumer Packagist photo: 18millionpixels

9. photo: 18millionpixels

10. { "require": { "monolog/monolog": “2.0” } } photo: 18millionpixels

11. { "require": { "monolog/monolog": “2.0” } } { "name": “monolog/monolog” ... } photo: 18millionpixels

12. { "require": { "monolog/monolog": “2.0” } } { "name": “monolog/monolog” ... } ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - The requested package monolog/monolog could not be found in any version, there may be a typo in the package name. Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. Installation failed, reverting ./composer.json to its original content. photo: 18millionpixels

13. { "require": { "monolog/monolog": “2.0” } } { "name": “monolog/monolog” ... } ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - The requested package monolog/monolog could not be found in any version, there may be a typo in the package name. Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. Installation failed, reverting ./composer.json to its original content. ___
 ~1.1 photo: 18millionpixels

14. { "require": { "monolog/monolog": “2.0” } } { "name": “monolog/monolog” ... } ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - The requested package monolog/monolog could not be found in any version, there may be a typo in the package name. Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. Installation failed, reverting ./composer.json to its original content. ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) - Installing psr/log (1.0.0) Loading from cache - Installing monolog/monolog (1.11.0) Downloading: 100% monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server) [...] monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server) monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB) monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar) Writing lock file Generating autoload files ___
 ~1.1 photo: 18millionpixels

15. composer

16. composercomposer.json!

17. composercomposer.json! composer.lock!

18. composercomposer.json! composer.lock!

19. discovery Packagist " composercomposer.json! composer.lock!

20. discovery sourcePackagist " Repository # composercomposer.json! composer.lock!

21. discovery source installation Packagist " Vendor
 Folder $ Repository # composercomposer.json! composer.lock!

22. 1 574 456 686

23. 1 574 456 686+

24. 1 574 456 686one billion, five hundred seventy-four million, four hundred fifty-six thousand, six hundred eighty-six +

25. $ composer init Library Publisher

26. $ composer init Library Publisher $ composer require <vendor>/<package> Library Consumer

27. $ composer require monolog/monolog Tip

28. $ composer require monolog/monolog Tip Using version ~1.11 for monolog/monolog

29. $ composer require monolog/monolog --sort-packages Tip

30. Library Publishers Composer for

31. Library Publisher Unique vendor names vendor / package

32. Library Publisher Unique vendor names pick your own 
 unique vendor

33. Library Publisher Unique vendor names or join a collective

34. README! CHANGELOG% LICENSE& Library Publisher What’s in your library?

35. README! CHANGELOG% LICENSE& Library Publisher What’s in your library? ' What problem does it solve? ' Usage examples ' Install instructions ' How can I contribute?

36. README! CHANGELOG% LICENSE& Library Publisher What’s in your library? ' List relevant changes ' Make BC breaks prominent ' Show examples of how to upgrade ' What problem does it solve? ' Usage examples ' Install instructions ' How can I contribute?

37. README! CHANGELOG% LICENSE& Library Publisher What’s in your library? ' List relevant changes ' Make BC breaks prominent ' Show examples of how to upgrade ' Pick one that reflects your values ' choosealicense.com can help ' What problem does it solve? ' Usage examples ' Install instructions ' How can I contribute?

38. Library Publisher Semantic Versioning 1 . 2 3.major minor patch

39. Library Publisher Semantic Versioning 1 . 2 3.major minor patch Bug Fixes

40. Library Publisher Semantic Versioning 1 . 2 3.major minor patch New Features Bug Fixes

41. Library Publisher Semantic Versioning 1 . 2 3.major minor patch API / BC Breaks New Features Bug Fixes

42. Library Publisher Tagging Please, tag your releases.

43. Library Publisher Tagging Please, tag your releases. often!

44. Library Publisher “I'm out" photo: nickwebb

45. Library Publisher “I'm out"

46. Library Publisher “I'm out" Click here and provide an alternative

47. Library Publisher “I'm out"

48. Pick the 
 correct 
 version Library Publisher Pick a Version

49. *the asterisk Library Publisher Pick a Version

50. *the asterisk○Library Publisher Pick a Version

51. ~the tilde Library Publisher Pick a Version

52. ~1.2 >=1.2.0, <2.0.0 Library Publisher Pick a Version

53. ~1.2 >=1.2.0, <2.0.0 Library Publisher Pick a Version )

54. ~1.2.3 >=1.2.3, <1.3 Library Publisher Pick a Version

55. ~1.2.3 >=1.2.3, <1.3 Library Publisher Pick a Version )

56. "require": { "zendframework/zend-stdlib": “2.1.*”, "zendframework/zend-servicemanager": "2.1.*", }, “require-dev": { “phpunit/phpunit": “~3.7” } Library Publisher Pick a Version "require": { "zendframework/zend-stdlib": “~2.3”, "zendframework/zend-servicemanager": “~2.3", }, “require-dev": { “phpunit/phpunit": “~4” } 3rd party library Your application

57. "require": { "zendframework/zend-stdlib": “2.1.*”, "zendframework/zend-servicemanager": "2.1.*", }, “require-dev": { “phpunit/phpunit": “~3.7” } Library Publisher Pick a Version "require": { "zendframework/zend-stdlib": “~2.3”, "zendframework/zend-servicemanager": “~2.3", }, “require-dev": { “phpunit/phpunit": “~4” } 3rd party library Your application *

58. "require": { "zendframework/zend-stdlib": “2.1.*”, "zendframework/zend-servicemanager": "2.1.*", }, “require-dev": { “phpunit/phpunit": “~3.7” } Library Publisher Pick a Version "require": { "zendframework/zend-stdlib": “~2.3”, "zendframework/zend-servicemanager": “~2.3", }, “require-dev": { “phpunit/phpunit": “~4” } 3rd party library Your application *

59. "require": { "zendframework/zend-stdlib": “2.1.*”, "zendframework/zend-servicemanager": "2.1.*", }, “require-dev": { “phpunit/phpunit": “~3.7” } Library Publisher Pick a Version "require": { "zendframework/zend-stdlib": “~2.3”, "zendframework/zend-servicemanager": “~2.3", }, “require-dev": { “phpunit/phpunit": “~4” } 3rd party library Your application * ~2.1

60. Yo @rdohms, I’m really happy for you and I’m gonna let you finish, but the tilde operator is totally old news.

61. ^the caret Library Publisher Pick a Version

62. 1.2.3 >=1.2.3, <2.0.0 Library Publisher Pick a Version ^

63. 1.2.3 >=1.2.3, <2.0.0 Library Publisher Pick a Version ) ^ )

64. 0.3.0 >=0.3.0, <0.4.0 Library Publisher Pick a Version ^

65. 0.3.0 >=0.3.0, <0.4.0 Library Publisher Pick a Version ^ )

66. 0.3.0 >=0.3.0, <0.4.0 Library Publisher Pick a Version ^ ) Major Version Zero

67. Library Consumers Composer for

68. Library Consumer Install or update? install or update?

69. Library Consumer Install or update? Make sure you have installed the last updates from other developers. ? install updateor

70. Library Consumer Install or update? Make sure you have installed the last updates from other developers. ? install updateor

71. Library Consumer Install or update? Deploying a new release of your application to production. ? install updateor

72. Library Consumer Install or update? Deploying a new release of your application to production. ? install updateor

73. Library Consumer Install or update? Checked out a new project and want to start coding. ? install updateor

74. Library Consumer Install or update? Checked out a new project and want to start coding. ? install updateor

75. Library Consumer Install or update? Grab new versions for the dependencies of your project. ? install updateor

76. Library Consumer Install or update? Grab new versions for the dependencies of your project. ? install updateor

77. Your application $ Public Repository # Library Consumer Install or update? composer.lock! composer install composer update

78. Your application $ Public Repository # Library Consumer Install or update? composer.lock! read composer install composer update

79. Your application $ Public Repository # Library Consumer Install or update? composer.lock! read grab version composer install composer update

80. Your application $ Public Repository # Library Consumer Install or update? composer.lock! read grab version check latest compatible release composer install composer update

81. Your application $ Public Repository # Library Consumer Install or update? composer.lock! read grab version check latest compatible release update composer install composer update

82. Library Consumer Install or update? commit your lock file

83. Pick the 
 correct 
 version Library Consumer Version Selection

84. Library Consumer Version Selection dev-master

85. Library Consumer Version Selection

86. Library Consumer Version Selection

87. Library Consumer Using forks found a bug?

88. Library Consumer Using forks $ composer install --prefer-source Tip

89. Library Consumer Using forks

90. Library Consumer Using forks patch it,

91. Library Consumer Using forks patch it, fork it,

92. Library Consumer Using forks patch it, fork it, push it…

93. Library Consumer Using forks patch it, fork it, push it… wait for it.

94. Library Consumer Using forks patch it, fork it, push it… wait for it.

95. Library Consumer Using forks symfony/symfony

96. Library Consumer Using forks symfony/symfony rdohms/symfony

97. Library Consumer Using forks symfony/symfony rdohms/symfony "repositories": [ { "type": "vcs", "url": "https://github.com/rdohms/symfony" } ]

98. Library Consumer Using forks symfony/symfony rdohms/symfony "repositories": [ { "type": "vcs", "url": "https://github.com/rdohms/symfony" } ] +

99. Library Consumer Using forks Do not put forked repositories
 on packagist ,

100. Library Consumer Using forks "require": { "symfony/symfony": "dev-my-patch as 2.5.0" } Tip

101. Library Consumer Composer and deployments Composer and production

102. Library Consumer Composer and deployments $ composer install --prefer-dist --no-dev --optimize-autoloader ,

103. Library Consumer Composer and deployments $ composer install --prefer-dist --no-dev --optimize-autoloader ,

104. Library Consumer Composer and deployments $ composer install --prefer-dist --no-dev --optimize-autoloader , - Install same versions - Uses information defined in the composer.lock file

105. $ composer install --prefer-dist --no-dev --optimize-autoloader Library Consumer Composer and deployments ,

106. $ composer install --prefer-dist --no-dev --optimize-autoloader Library Consumer Composer and deployments , - Downloads distribution packages - Can use local cache for previously downloaded - No git required

107. $ composer install --prefer-dist --no-dev --optimize-autoloader Library Consumer Composer and deployments ,

108. $ composer install --prefer-dist --no-dev --optimize-autoloader Library Consumer Composer and deployments , - Avoids download unnecessary developer libraries

109. $ composer install --prefer-dist --no-dev --optimize-autoloader Library Consumer Composer and deployments ,

110. $ composer install --prefer-dist --no-dev --optimize-autoloader Library Consumer Composer and deployments , - Generates classmap from PSR-0/4 autoloaders - Speeds up autoloading

111. Library Consumer Licensing $ composer licenses Name: __root__ Version: 1.0.0 Licenses: none Dependencies: doctrine/annotations v1.2.1 MIT doctrine/cache v1.3.1 MIT doctrine/collections v1.2 MIT doctrine/common v2.4.2 MIT doctrine/inflector v1.0 MIT doctrine/lexer v1.0 MIT psr/log 1.0.0 MIT symfony/symfony v2.5.6 MIT twig/twig v1.16.2 BSD-3-Clause Tip

112. Library Consumer Simulating Environments Tip Production Server . Development Server .

113. Library Consumer Simulating Environments Tip Production Server . Development Server .PHP 7.0 PHP 5.6

114. Library Consumer Simulating Environments "config": { "platform": { "php": “5.6.2”, “ext-mongodb”: “1.1” } }, Tip Production Server . Development Server .PHP 7.0 PHP 5.6

115. Library Consumer Simulating Environments $ composer install —-ignore-platform-reqs Tip

116. Library Consumer Private Packages and Proxy Satis and Toran

117. composer Packagist " Your application $ Public Repository # Library Consumer Private Packages and Proxy

118. composer Packagist " Your application $ Public Repository # Satis / Toran " Private Repository / proxy Library Consumer Private Packages and Proxy

119. Library Consumer Private Packages and Proxy toranproxy.com private repos, automatic packagist proxy and support composer development

120. Library Consumer Tooling $ composer require jquery/jquery How many of you?

121. Library Consumer Tooling

122. Library Consumer Tooling

123. Javascript only Developer Library Consumer Tooling 0 my-js-library 1

124. Javascript only Developer Library Consumer Tooling 0 my-js-library ! package.json 1

125. Javascript only Developer Library Consumer Tooling 0 my-js-library ! package.json ! bower.json 1

126. Javascript only Developer Library Consumer Tooling 0 my-js-library ! composer.json ! package.json ! bower.json 1

127. Javascript only Developer Library Consumer Tooling 0 my-js-library ! composer.json ! package.json ! bower.json ! .gemspec 1

128. Javascript only Developer Library Consumer Tooling 0 my-js-library ! composer.json ! package.json ! bower.json ! .gemspec 1 2 2

129. Library Consumer Tooling

130. Library Consumer Tooling Right tool.
 Right job.

131. Library Consumer One last thing One last thing…

132. Library Consumer pickle!

133. Library Consumer pickle! $ pickle install memcache https://wiki.php.net/rfc/pickle https://github.com/FriendsOfPHP/pickle

134. Thank you. https://joind.in/talk/6f5e4 https://leanpub.com/ composer-cookbook

135. Thank you.any questions? 3 http://slides.doh.ms 4 http://doh.ms 5 @rdohms https://joind.in/talk/6f5e4 https://leanpub.com/ composer-cookbook

Add a comment

Related pages

Composer | LinkedIn

Composer the Right Way - PHPSRB16. 2,212 Views. philsturgeon. Laravel and Composer. 7,750 Views. djtrent. ... Composer the Right Way - PHPBNL16. 1,337 ...
Read more

Peter Decuyper on Twitter: "Composer the Right Way by ...

Verified account @ Suggested users Verified account @ Verified account @
Read more

Peter Decuyper (@sgrame) | Twitter

Peter Decuyper @ sgrame ... Composer the Right Way by @rdohms #sketchnotes @phpbenelux #phpbnl16 pic.twitter.com/WM9jyb0BbB.
Read more

Composer Of: | LinkedIn

Composer Of: Articles, experts, jobs, and more: get all the professional insights you need on LinkedIn. ... Film Composer at Sandra Marsh Management, ...
Read more