SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
Composer has triggered a renaissance in the PHP community, it has changed the way we deal with other people’s code and it has changed the way we share our code. We are all slowly moving to using Composer, from Wordpress to Joomla and Drupal and frameworks in between. But many of us mistreat composer, follow outdated practices or simply lack a few tricks. In this session i’ll get you the low down on how to use composer the right way.
Composer has triggered a renaissance in the PHP community, it has changed the way we deal with other people’s code and it has changed the way we share our code. We are all slowly moving to using Composer, from Wordpress to Joomla and Drupal and frameworks in between. But many of us mistreat composer, follow outdated practices or simply lack a few tricks. In this session i’ll get you the low down on how to use composer the right way.
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
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?
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
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
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?