SlideShare a Scribd company logo
Rafael Dohms / @rdohms




C!"p#$r
   Putting your dependencies on the score
Rafael Dohms




                           photo credit: Eli White
        @rdohms


 Evangelist, Speaker and
      Contributor.

Developer at WEBclusive.

Enabler at AmsterdamPHP.
%$ E&$v'(!r P)(*+
     a general introduction to Composer




     Ev$r,-', *!"p#)./
      the basic stuff you need to know




  Up/r'-)./ (! ' M'$0(r!
advanced features for more complex scenarios




       1.-)./ ,!2r (2.$
      discovering and sharing libraries
%$ E&$v'(!r P)(*+
per project          system wide
central repository   spread out channels
open acceptance        strict standards
Pr!b&$":
I need my team and my deployments to use consistent
      versions of the dependencies of my project
Pr!b&$":
I need my team and my deployments to use consistent
      versions of the dependencies of my project


S!&2()!.:
Pr!b&$":
I need my team and my deployments to use consistent
      versions of the dependencies of my project


S!&2()!.:
                       PEAR
Pr!b&$":
I need my team and my deployments to use consistent
      versions of the dependencies of my project


S!&2()!.:
                      PEAR
                   SVN Externals
Pr!b&$":
I need my team and my deployments to use consistent
      versions of the dependencies of my project


S!&2()!.:
                       PEAR
                   SVN Externals
                  Git Submodules
Pr!b&$":
I need my team and my deployments to use consistent
      versions of the dependencies of my project


S!&2()!.:
                      PEAR
                  SVN Externals
                 Git Submodules
             vendor management script
Pr!b&$":
I need my team and my deployments to use consistent
      versions of the dependencies of my project


S!&2()!.:
                      PEAR
                  SVN Externals
                 Git Submodules
             vendor management script


                  C!"p#$r!
A per-project dependency
  manager that allows you to
  declare a consistent list of
dependencies and versions for
 your application, as well as a
consistent way of sharing your
  libraries and making them
      discoverable using
         packagist.org
Ev$r,-', C!"p#)./
I.0('&&)./ C!"p#$r

Local (embed)
$ curl -s http://getcomposer.org/installer | php


Global
$ curl -s http://getcomposer.org/installer | php -- --install-dir=bin
I.0('&&)./ C!"p#$r

Local (embed)
$ curl -s http://getcomposer.org/installer | php


Global
$ curl -s http://getcomposer.org/installer | php -- --install-dir=bin




       3p:    $ ln -s /usr/bin/composer.phar /usr/bin/composer
I.0('&&)./ C!"p#$r
I.0('&&)./ C!"p#$r



  $ composer.phar --version
  Composer version 6573fd3
I.0('&&)./ C!"p#$r


     php

  $ composer.phar --version
  Composer version 6573fd3
K$$p )( 2p-'($-!
K$$p )( 2p-'($-!



$ composer.phar self-update

Updating to version 65e95ed.
    Downloading: 100%
C!"p#$r 101
C!"p#$r 101

$ cd ~/dev/myproject
C!"p#$r 101

$ cd ~/dev/myproject
$ vim composer.json



    {
        "require": {
            "silex/silex": "1.0.*"
        },

        "minimum-stability": "dev"
    }
C!"p#$r 101

$ cd ~/dev/myproject
$ vim composer.json     note: project root



    {
        "require": {
            "silex/silex": "1.0.*"
        },

        "minimum-stability": "dev"
    }
C!"p#$r 101

$ cd ~/dev/myproject
$ vim composer.json     note: project root


                                      “require”: required packages and
    {                                              versions
        "require": {
            "silex/silex": "1.0.*"           adv. ex.: >=1.0.0,<1.2-dev
        },

        "minimum-stability": "dev"
    }
C!"p#$r 101

$ cd ~/dev/myproject
$ vim composer.json     note: project root


                                      “require”: required packages and
    {                                              versions
        "require": {
            "silex/silex": "1.0.*"           adv. ex.: >=1.0.0,<1.2-dev
        },

        "minimum-stability": "dev"     “minimum-stability”: if you only
    }                                      want stable packages

                                                  default: stable
C!"p#$r 101

$ cd ~/dev/myproject
$ vim composer.json        note: project root


                                         “require”: required packages and
    {                                                 versions
        "require": {
            "silex/silex": "1.0.*"              adv. ex.: >=1.0.0,<1.2-dev
        },

        "minimum-stability": "dev"        “minimum-stability”: if you only
    }                                         want stable packages

                                                     default: stable

$ composer.phar install
Installing dependencies
  - Installing pimple/pimple (dev-master)
    Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be

  - Installing symfony/routing (dev-master)
    Cloning 6bca82c3ea0d42d750de4f49b22020dfd047dc0f

  [...]

  - Installing silex/silex (dev-master)
    Cloning 18e248a277adb061602d2bcabe96011db1c76ec0

symfony/routing suggests installing symfony/config (dev-master)
symfony/routing suggests installing symfony/yaml (dev-master)
symfony/routing suggests installing doctrine/common (>=2.2,<2.3)
[...]
silex/silex suggests installing symfony/browser-kit (2.1.*)
silex/silex suggests installing symfony/css-selector (2.1.*)
silex/silex suggests installing symfony/dom-crawler (2.1.*)
Writing lock file
Generating autoload files
Installing dependencies
  - Installing pimple/pimple (dev-master)                  your
    Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be   dependency’s
  - Installing symfony/routing (dev-master)
                                                       dependencies
    Cloning 6bca82c3ea0d42d750de4f49b22020dfd047dc0f

  [...]

  - Installing silex/silex (dev-master)
    Cloning 18e248a277adb061602d2bcabe96011db1c76ec0

symfony/routing suggests installing symfony/config (dev-master)
symfony/routing suggests installing symfony/yaml (dev-master)
symfony/routing suggests installing doctrine/common (>=2.2,<2.3)
[...]
silex/silex suggests installing symfony/browser-kit (2.1.*)
silex/silex suggests installing symfony/css-selector (2.1.*)
silex/silex suggests installing symfony/dom-crawler (2.1.*)
Writing lock file
Generating autoload files
Installing dependencies
  - Installing pimple/pimple (dev-master)                  your
    Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be   dependency’s
  - Installing symfony/routing (dev-master)
                                                       dependencies
    Cloning 6bca82c3ea0d42d750de4f49b22020dfd047dc0f

  [...]

  - Installing silex/silex (dev-master)                your dependency
    Cloning 18e248a277adb061602d2bcabe96011db1c76ec0

symfony/routing suggests installing symfony/config (dev-master)
symfony/routing suggests installing symfony/yaml (dev-master)
symfony/routing suggests installing doctrine/common (>=2.2,<2.3)
[...]
silex/silex suggests installing symfony/browser-kit (2.1.*)
silex/silex suggests installing symfony/css-selector (2.1.*)
silex/silex suggests installing symfony/dom-crawler (2.1.*)
Writing lock file
Generating autoload files
Installing dependencies
  - Installing pimple/pimple (dev-master)                  your
    Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be   dependency’s
  - Installing symfony/routing (dev-master)
                                                       dependencies
    Cloning 6bca82c3ea0d42d750de4f49b22020dfd047dc0f

  [...]

  - Installing silex/silex (dev-master)                your dependency
    Cloning 18e248a277adb061602d2bcabe96011db1c76ec0

symfony/routing suggests installing symfony/config (dev-master)
symfony/routing suggests installing symfony/yaml (dev-master)
symfony/routing suggests installing doctrine/common (>=2.2,<2.3)
[...]
silex/silex suggests installing symfony/browser-kit (2.1.*)
silex/silex suggests installing symfony/css-selector (2.1.*)
silex/silex suggests installing symfony/dom-crawler (2.1.*)
Writing lock file
Generating autoload files
                                  suggestions of other packages,
                                       for further features
P)*42p (+$ ($"p!!
Let Composer bootstrap you development
B!!(0(r'pp)./ Pr!5$*(0

$ composer.phar create-project fabpot/silex-skeleton ~/dev/myproject
B!!(0(r'pp)./ Pr!5$*(0

$ composer.phar create-project fabpot/silex-skeleton ~/dev/myproject

Installing fabpot/silex-skeleton (dev-master
cc19d406cf3cac253715db92d400992d4f3e1b52)
  - Installing fabpot/silex-skeleton (dev-master)
    Cloning master

Created project in one-liner/
Installing dependencies
  - Installing pimple/pimple (dev-master)
    Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be

  [...]

symfony/routing suggests installing symfony/yaml (dev-master)
[...]

Writing lock file
Generating autoload files
B!!(0(r'pp)./ Pr!5$*(0

$ composer.phar create-project fabpot/silex-skeleton ~/dev/myproject

Installing fabpot/silex-skeleton (dev-master
cc19d406cf3cac253715db92d400992d4f3e1b52)
  - Installing fabpot/silex-skeleton (dev-master)
    Cloning master

Created project in one-liner/
                                                      myproje
Installing dependencies                                       ct/
  - Installing pimple/pimple (dev-master)               compose
                                                                r.json
    Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be    compose
                                                                r.lock
                                                        config/
  [...]                                                console
                                                               /
                                                       src/
                                                       templat
symfony/routing suggests installing symfony/yaml (dev-master) es/
                                                      vendor/
[...]
                                                      web/
Writing lock file
Generating autoload files
I w'.( (! *!.(r)b2($ ' pr!5$*(
  Composer can set that up for you.
B!!(0(r'pp)./ C!.(r)b2()!.0

$ composer.phar create-project dms/dms --dev ~/dev/oss/dms
B!!(0(r'pp)./ C!.(r)b2()!.0
                                        gimme dev packages


$ composer.phar create-project dms/dms --dev ~/dev/oss/dms
B!!(0(r'pp)./ C!.(r)b2()!.0
                                        gimme dev packages


$ composer.phar create-project dms/dms --dev ~/dev/oss/dms




          "require-dev": {
              "symfony/symfony": ">=2.1-dev",
              "doctrine/orm":    "dev-master"
          },
B!!(0(r'pp)./ C!.(r)b2()!.0
                                                  gimme dev packages


$ composer.phar create-project dms/dms --dev ~/dev/oss/dms




          "require-dev": {
              "symfony/symfony": ">=2.1-dev",
              "doctrine/orm":    "dev-master"
          },
            “require-dev”: only needed if you are going
                           to contribute
H!w -! I 6.-/&!'- (+$ 6&$0?
  PSR-0 and the modern autoloader
Composer generates an
autoload file for all your
     dependencies
Composer generates an
autoload file for all your
     dependencies


   vendor/autoload.php
"autoload": {
    "psr-0": { "MyNamespace": "<root>" },



     "classmap": ["src/", "lib/", "Something.php"],



     "files": ["src/MyLibrary/functions.php"]

},
“autoload”: describes the autoloading needed for
                        your library
"autoload": {
    "psr-0": { "MyNamespace": "<root>" },



     "classmap": ["src/", "lib/", "Something.php"],



      "files": ["src/MyLibrary/functions.php"]

},
“autoload”: describes the autoloading needed for
                        your library
"autoload": {
    "psr-0": { "MyNamespace": "<root>" “psr-0”: PSR-0 Compatible libraries
                                        },



     "classmap": ["src/", "lib/", "Something.php"],



      "files": ["src/MyLibrary/functions.php"]

},
“autoload”: describes the autoloading needed for
                        your library
"autoload": {
    "psr-0": { "MyNamespace": "<root>" “psr-0”: PSR-0 Compatible libraries
                                        },



     "classmap": ["src/", "lib/", "Something.php"], PEAR packages and
                                       “classmap”: Old
                                                        other libraries


      "files": ["src/MyLibrary/functions.php"]

},
“autoload”: describes the autoloading needed for
                        your library
"autoload": {
    "psr-0": { "MyNamespace": "<root>" “psr-0”: PSR-0 Compatible libraries
                                        },



     "classmap": ["src/", "lib/", "Something.php"], PEAR packages and
                                       “classmap”: Old
                                                        other libraries


      "files": ["src/MyLibrary/functions.php"]
                                            “files”: for php functions or
                                                        initializations
},
I.0('&&)./, 2p-'()./ '.- "!v)./ !.
  how does Composer guarantee consistency
composer.json
“composer.json”: metadata and
    list of your dependencies.


composer.json
“composer.json”: metadata and
    list of your dependencies.


composer.json



composer.lock
“composer.json”: metadata and
    list of your dependencies.


composer.json



composer.lock


    “composer.lock”: existing
    dependencies and current
        commit hashes.
composer.json



composer.lock
update



         composer.json



         composer.lock
update                   install



         composer.json



         composer.lock
update                           install


         reads
                 composer.json



                 composer.lock
update                             install


         reads
                   composer.json



                   composer.lock




     gets latest
update                                    install


         reads
                          composer.json


                 writes
                          composer.lock




     gets latest
update                                       install


         reads                            reads

                          composer.json


                 writes
                          composer.lock




     gets latest
update                                         install


         reads                             reads

                          composer.json

                                          compares
                 writes
                          composer.lock




     gets latest
update                                              install


         reads                                  reads

                          composer.json

                                              compares
                 writes
                          composer.lock




     gets latest                          gets locked version
D$v$&!p)./ '. App ). ' ($'"?

 Commit you composer.lock file
  into the repository, and use
        composer install.
D$v$&!p)./ '. App ). ' ($'"?

 Commit you composer.lock file
  into the repository, and use
        composer install.

                  will ensure everyone is
                   on the same “page”
I’" -$v$&!p)./ ' &)br'r,, +$&p!
here are some fields you should care about
{
    "name": "vendor-namespace/package-name",
    "type": "symfony-bundle",
    "description": "A sample package for examples",
    "keywords": ["php", "package"],
    "homepage": "http://doh.ms",
    "license": "MIT",
    "support": {
        "email": "support@mylib.com",
        "issues": "http://issues.lib.com"
    }

    "target-dir": "/folder/to/install",
}
“name”: this should be unique, pick a good one!
{
    "name": "vendor-namespace/package-name",
    "type": "symfony-bundle",
    "description": "A sample package for examples",
    "keywords": ["php", "package"],
    "homepage": "http://doh.ms",
    "license": "MIT",
    "support": {
        "email": "support@mylib.com",
        "issues": "http://issues.lib.com"
    }

    "target-dir": "/folder/to/install",
}
“name”: this should be unique, pick a good one!
{
    "name": "vendor-namespace/package-name",
                                  “type”: will be used for more
    "type": "symfony-bundle",
                                    advanced “custom”installs
    "description": "A sample package for examples",
    "keywords": ["php", "package"],
    "homepage": "http://doh.ms",
    "license": "MIT",
    "support": {
        "email": "support@mylib.com",
        "issues": "http://issues.lib.com"
    }

    "target-dir": "/folder/to/install",
}
“name”: this should be unique, pick a good one!
{
    "name": "vendor-namespace/package-name",
                                  “type”: will be used for more
    "type": "symfony-bundle",
                                    advanced “custom”installs
    "description": "A sample package for examples",
    "keywords": ["php", "package"],
    "homepage": "http://doh.ms",
    "license": "MIT",                  “license”: very important!
    "support": {
        "email": "support@mylib.com",
        "issues": "http://issues.lib.com"
    }

    "target-dir": "/folder/to/install",
}
“name”: this should be unique, pick a good one!
{
    "name": "vendor-namespace/package-name",
                                  “type”: will be used for more
    "type": "symfony-bundle",
                                    advanced “custom”installs
    "description": "A sample package for examples",
    "keywords": ["php", "package"],
    "homepage": "http://doh.ms",
    "license": "MIT",                  “license”: very important!
    "support": {
                                   “support”: point people the right
        "email": "support@mylib.com",
        "issues": "http://issues.lib.com"         way.
    }

    "target-dir": "/folder/to/install",
}
“name”: this should be unique, pick a good one!
{
    "name": "vendor-namespace/package-name",
                                  “type”: will be used for more
    "type": "symfony-bundle",
                                    advanced “custom”installs
    "description": "A sample package for examples",
    "keywords": ["php", "package"],
    "homepage": "http://doh.ms",
    "license": "MIT",                  “license”: very important!
    "support": {
                                   “support”: point people the right
        "email": "support@mylib.com",
        "issues": "http://issues.lib.com"         way.
    }

    "target-dir": "/folder/to/install",
}
          “target-dir”: great for installing sub-dir splits
                           repositories

         ex: Symfony Bundles: /Acme/Bundle/MyBundle
M, *!-$ )0 PHP 5.4 !.&,!
 managing system dependencies
{
    "require": {
        "php": ">=5.3.3",
        "ext-ldap": "*"
    }
}
{                    “php”: PHP version.
    "require": {
        "php": ">=5.3.3",
        "ext-ldap": "*"
    }
}
{                     “php”: PHP version.
    "require": {
        "php": ">=5.3.3",
        "ext-ldap": "*"
    }
                  “ext-*”: Presence of selected
}                           extension
Up/r'-)./ (! ' M'$0(r!
B2( I .$$- ' 0p$*)6* v$r0)!.
  version modifiers to the rescue!
"acme/foo": "1.0.x-dev#3ebbe75"
“#<ref>”: Get this specific
               commit

"acme/foo": "1.0.x-dev#3ebbe75"
“#<ref>”: Get this specific
               commit

"acme/foo": "1.0.x-dev#3ebbe75"




      "acme/foo": "@dev"
   "acme/foo": "1.0.*@beta"
“#<ref>”: Get this specific
               commit

"acme/foo": "1.0.x-dev#3ebbe75"




      "acme/foo": "@dev"
   "acme/foo": "1.0.*@beta"


      “@<state>”: Get a version
     outside your default stability
I .$$- (! 7$*2($ ' f$w 0*r)p(0
 how to automate tasks with Composer
    "scripts": {
        "post-install-cmd": [
            "SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap",
            "SensioBundleDistributionBundleComposerScriptHandler::clearCache",
            "SensioBundleDistributionBundleComposerScriptHandler::installAssets",
            "SensioBundleDistributionBundleComposerScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap",
            "SensioBundleDistributionBundleComposerScriptHandler::clearCache",
            "SensioBundleDistributionBundleComposerScriptHandler::installAssets",
            "SensioBundleDistributionBundleComposerScriptHandler::installRequirementsFile"
        ]
    },
“scripts”: allows you to run scripts at given moments

    "scripts": {
        "post-install-cmd": [
            "SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap",
            "SensioBundleDistributionBundleComposerScriptHandler::clearCache",
            "SensioBundleDistributionBundleComposerScriptHandler::installAssets",
            "SensioBundleDistributionBundleComposerScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap",
            "SensioBundleDistributionBundleComposerScriptHandler::clearCache",
            "SensioBundleDistributionBundleComposerScriptHandler::installAssets",
            "SensioBundleDistributionBundleComposerScriptHandler::installRequirementsFile"
        ]
    },
C20(!" R$p#)(!r)$0 !r .!
 C!"p#$r, w+'( .!w?
Injecting Composer into wild packages
“hero/superpackage”: “dev-master”
“hero/superpackage”: “dev-master”
“hero/superpackage”: “dev-master”
“hero/superpackage”: “dev-master”
“hero/superpackage”: “dev-master”




    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/rdohms/hero-superpackage"
        }       
    ]
“hero/superpackage”: “dev-master”




         “repositories”: point to non-indexed, override existing or on-
                                the-fly packages

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/rdohms/hero-superpackage"
        }       
    ]
N!.-C!"p#$r P'*4'/$
{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "smarty/smarty",
                "version": "3.1.7",
                "dist": {
                    "url": "http://www.smarty.net/files/Smarty-3.1.7.zip",
                    "type": "zip"
                },
                "source": {
                    "url": "http://smarty-php.googlecode.com/svn/",
                    "type": "svn",
                    "reference": "tags/Smarty_3_1_7/distribution/"
                }
            }
        }
    ]
}
N!.-C!"p#$r P'*4'/$
{
    "repositories": [
                     “package”: on-the-fly package, injecting a
        {                            composer.json
            "type": "package",
            "package": {
                "name": "smarty/smarty",
                "version": "3.1.7",
                "dist": {
                    "url": "http://www.smarty.net/files/Smarty-3.1.7.zip",
                    "type": "zip"
                },
                "source": {
                    "url": "http://smarty-php.googlecode.com/svn/",
                    "type": "svn",
                    "reference": "tags/Smarty_3_1_7/distribution/"
                }
            }
        }
    ]
}
N!.-C!"p#$r P'*4'/$
{
    "repositories": [
                     “package”: on-the-fly package, injecting a
        {                            composer.json
            "type": "package",
            "package": {
                "name": "smarty/smarty",
                "version": "3.1.7",
                "dist": {
                    "url": "http://www.smarty.net/files/Smarty-3.1.7.zip",
                    "type": "zip"                                         SVN   / Git
                },
                "source": {
                    "url": "http://smarty-php.googlecode.com/svn/",
                    "type": "svn",
                    "reference": "tags/Smarty_3_1_7/distribution/"
                }
            }
        }
    ]
}
I .$$- (+)0 PEAR p'*4'/$...
         No Problem!
{
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear2.php.net"
        }
    ],
    "require": {
        "pear-pear2.php.net/PEAR2_Text_Markdown": "*",
        "pear-pear2/PEAR2_HTTP_Request": "*"
    }
}
{
                        “pear”: official PEAR and custom PEAR
    "repositories": [
                                         channels
        {
            "type": "pear",
            "url": "http://pear2.php.net"
        }
    ],
    "require": {
        "pear-pear2.php.net/PEAR2_Text_Markdown": "*",
        "pear-pear2/PEAR2_HTTP_Request": "*"
    }
}
{
                        “pear”: official PEAR and custom PEAR
    "repositories": [
                                         channels
        {
            "type": "pear",
            "url": "http://pear2.php.net"
        }
    ],
    "require": {
        "pear-pear2.php.net/PEAR2_Text_Markdown": "*",
        "pear-pear2/PEAR2_HTTP_Request": "*"
    }
}            Remember the prefix!
{
                        “pear”: official PEAR and custom PEAR
    "repositories": [
                                         channels
        {
            "type": "pear",
            "url": "http://pear2.php.net"
        }
    ],
    "require": {
        "pear-pear2.php.net/PEAR2_Text_Markdown": "*",
        "pear-pear2/PEAR2_HTTP_Request": "*"
    }
}            Remember the prefix!




                         !!   Warning: PEAR causes a overhead of requests
alias




replace   provide
alias

{
    "extra": {
        "branch-alias": {
            "dev-master": "1.0.x-dev"
        }
    },

    "require": {
        "monolog/monolog": "dev-bugfix as 1.0.x-dev"
    }
}




replace                                          provide
alias

{
    "extra": {
        "branch-alias": {
            "dev-master": "1.0.x-dev"
        }
    },

    "require": {
        "monolog/monolog": "dev-bugfix as 1.0.x-dev"
    }
}




replace                                          provide

  “replace”: allows you to
replace other packages, and
be used them in their place.
alias

{
    "extra": {
        "branch-alias": {
            "dev-master": "1.0.x-dev"
        }
    },

    "require": {
        "monolog/monolog": "dev-bugfix as 1.0.x-dev"
    }
}




replace                                          provide

  “replace”: allows you to                       “provide”: allows you to say
replace other packages, and                         a package provides a
be used them in their place.                            expectation.
1.-)./ ,!2r (2.$
I .$$- ' &)br'r, (+'( -!$0..
     Let me get that for you
http://packagist.org/
usage info




                        package info




versions
$ composer.phar search filter
$ composer.phar search filter


dms/dms-filter-bundle             : DMS Filter Bundle, makes Annotation based ...
lexik/form-filter-bundle          : This bundle aim to provide classes to
build...
rollerworks/recordfilter-bundle   :   Record search-filtering bundle for Symfony
brikou/zend_filter                :   Zend Framework Filter Library
ext-filter                        :   The filter PHP extension
dms/dms-filter                    :   DMS Library, includes various bundles and ...
shtumi/useful-bundle              :   Symfony ShtumiUsefulBundle
$ composer.phar show dms/dms-filter-bundle
$ composer.phar show dms/dms-filter-bundle



name     : dms/dms-filter-bundle
descrip. : DMS Filter Bundle, makes Annotation based entity filtering
available in Symfony
keywords : symfony, bundle, filter, dms
versions : dev-master, v1.1.1, v1.1, 1.0.2, 1.0.1, 1.0.0
type     : symfony-bundle
license : MIT
source   : [git] https://github.com/rdohms/DMSFilterBundle v1.1.1
dist     : [zip] https://github.com/rdohms/DMSFilterBundle/zipball/
v1.1.1 v1.1.1
names    : dms/dms-filter-bundle

autoload
psr-0
DMSBundleFilterBundle => .

requires
php >=5.3.2
dms/dms-filter >=1.0.2
B2( ", r$p#)(!r, )0 pr)v'($!
  Get your own package repository
S'()0!
R!&&!2( ,!2r !w. S'()0
$ composer.phar create-project composer/satis
R!&&!2( ,!2r !w. S'()0
$ composer.phar create-project composer/satis
$ vi packages.json


  {
      "name": "My Repository",
      "homepage": "http://packages.example.org",
      "repositories": [
          { "type": "vcs", "url": "http://github.com/mycompany/privaterepo" },
          { "type": "vcs", "url": "http://svn.example.org/private/repo" },
          { "type": "vcs", "url": "http://github.com/mycompany/privaterepo2" }
      ],
      "require-all": true
  }
R!&&!2( ,!2r !w. S'()0
$ composer.phar create-project composer/satis
$ vi packages.json


  {
      "name": "My Repository",
      "homepage": "http://packages.example.org",
      "repositories": [
          { "type": "vcs", "url": "http://github.com/mycompany/privaterepo" },
          { "type": "vcs", "url": "http://svn.example.org/private/repo" },
          { "type": "vcs", "url": "http://github.com/mycompany/privaterepo2" }
      ],
      "require-all": true
  }



$ php bin/satis build config.json web/
U0)./ ,!2r !w. S'()0
{
    "repositories": [
        {
            "type": "composer",
            "url": "http://packages.yourdomain.net"
        }
    ],

    “require”: {
        “myvendor/mypackage”: “dev-master”
    }
}
U0)./ ,!2r !w. S'()0
{
    "repositories": [     “composer”: use this just like it was Packagist
        {
            "type": "composer",
            "url": "http://packages.yourdomain.net"
        }
    ],

    “require”: {
        “myvendor/mypackage”: “dev-master”
    }
}
W+$r$ 0+!2&- I /$( +$&p?

    http://getcomposer.org

 #composer on irc.freenode.org
%$ E&$v'(!r P)(*+
     Dependency Manager, consistent versions, per-project




               Ev$r,-', *!"p#)./
               install, update, lock and autoload




           Up/r'-)./ (! ' M'$0(r!
post-install, overriding, PEAR integration, developer environment




                 1.-)./ ,!2r (2.$
                       Satis and Packagist
%'.4 ,!2!
                  https://joind.in/7051



@rdohms

http://doh.ms

http://slides.doh.ms

More Related Content

What's hot

ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
ZFConf Conference
 
Composer
ComposerComposer
Composer
Tom Corrigan
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
lutter
 
kubernetes practice
kubernetes practicekubernetes practice
kubernetes practice
wonyong hwang
 
Docker practice
Docker practiceDocker practice
Docker practice
wonyong hwang
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 
App development with quasar (pdf)
App development with quasar (pdf)App development with quasar (pdf)
App development with quasar (pdf)
wonyong hwang
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-api
Eric Ahn
 
PHPCon China 2018 - 好孩子的 PHP 撰碼指南
PHPCon China 2018 - 好孩子的 PHP 撰碼指南PHPCon China 2018 - 好孩子的 PHP 撰碼指南
PHPCon China 2018 - 好孩子的 PHP 撰碼指南
Shengyou Fan
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
Jason Grimes
 
Docker command
Docker commandDocker command
Docker command
Eric Ahn
 
Composer the right way - SunshinePHP
Composer the right way - SunshinePHPComposer the right way - SunshinePHP
Composer the right way - SunshinePHP
Rafael Dohms
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
Ian Barber
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDD
Eric Hogue
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
Michele Orselli
 
Guarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingGuarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous Testing
Eric Hogue
 
Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13
Rafael Dohms
 
Vagrant move over, here is Docker
Vagrant move over, here is DockerVagrant move over, here is Docker
Vagrant move over, here is Docker
Nick Belhomme
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js Applications
Ben Hall
 
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
NETWAYS
 

What's hot (20)

ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
 
Composer
ComposerComposer
Composer
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
kubernetes practice
kubernetes practicekubernetes practice
kubernetes practice
 
Docker practice
Docker practiceDocker practice
Docker practice
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
App development with quasar (pdf)
App development with quasar (pdf)App development with quasar (pdf)
App development with quasar (pdf)
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-api
 
PHPCon China 2018 - 好孩子的 PHP 撰碼指南
PHPCon China 2018 - 好孩子的 PHP 撰碼指南PHPCon China 2018 - 好孩子的 PHP 撰碼指南
PHPCon China 2018 - 好孩子的 PHP 撰碼指南
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Docker command
Docker commandDocker command
Docker command
 
Composer the right way - SunshinePHP
Composer the right way - SunshinePHPComposer the right way - SunshinePHP
Composer the right way - SunshinePHP
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDD
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Guarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingGuarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous Testing
 
Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13
 
Vagrant move over, here is Docker
Vagrant move over, here is DockerVagrant move over, here is Docker
Vagrant move over, here is Docker
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js Applications
 
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
 

Viewers also liked

Annotating with Annotations - ForumPHP 2012
Annotating with Annotations - ForumPHP 2012Annotating with Annotations - ForumPHP 2012
Annotating with Annotations - ForumPHP 2012
Rafael Dohms
 
Symfony2: Interacción con CSS, JS y HTML5
Symfony2: Interacción con CSS, JS y HTML5Symfony2: Interacción con CSS, JS y HTML5
Symfony2: Interacción con CSS, JS y HTML5
Raul Fraile
 
C commerce
C commerceC commerce
Guida alla preparazione del lavoro di gruppo - OSIA
Guida alla preparazione del lavoro di gruppo - OSIAGuida alla preparazione del lavoro di gruppo - OSIA
Guida alla preparazione del lavoro di gruppo - OSIAMichele Poian
 
Annotating with Annotations - DPC UnCon
Annotating with Annotations - DPC UnConAnnotating with Annotations - DPC UnCon
Annotating with Annotations - DPC UnCon
Rafael Dohms
 
Annotations in PHP: They Exist
Annotations in PHP: They ExistAnnotations in PHP: They Exist
Annotations in PHP: They Exist
Rafael Dohms
 

Viewers also liked (6)

Annotating with Annotations - ForumPHP 2012
Annotating with Annotations - ForumPHP 2012Annotating with Annotations - ForumPHP 2012
Annotating with Annotations - ForumPHP 2012
 
Symfony2: Interacción con CSS, JS y HTML5
Symfony2: Interacción con CSS, JS y HTML5Symfony2: Interacción con CSS, JS y HTML5
Symfony2: Interacción con CSS, JS y HTML5
 
C commerce
C commerceC commerce
C commerce
 
Guida alla preparazione del lavoro di gruppo - OSIA
Guida alla preparazione del lavoro di gruppo - OSIAGuida alla preparazione del lavoro di gruppo - OSIA
Guida alla preparazione del lavoro di gruppo - OSIA
 
Annotating with Annotations - DPC UnCon
Annotating with Annotations - DPC UnConAnnotating with Annotations - DPC UnCon
Annotating with Annotations - DPC UnCon
 
Annotations in PHP: They Exist
Annotations in PHP: They ExistAnnotations in PHP: They Exist
Annotations in PHP: They Exist
 

Similar to Composer, putting dependencies on the score

Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
Arto Artnik
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
Ben Hall
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
Sumedt Jitpukdebodin
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
Ben Hall
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
Puppet
 
May The Nodejs Be With You
May The Nodejs Be With YouMay The Nodejs Be With You
May The Nodejs Be With You
Dalibor Gogic
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
Leo Lorieri
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
Ramazan K
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
Pablo Godel
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
Bo-Yi Wu
 
Docker container management
Docker container managementDocker container management
Docker container management
Karol Kreft
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
Sylvain Rayé
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
Docker, Inc.
 
Laravel Day / Deploy
Laravel Day / DeployLaravel Day / Deploy
Laravel Day / Deploy
Simone Gentili
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
Patrick Mizer
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
PROIDEA
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
miguel dominguez
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
MortazaJohari
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Yevgeniy Brikman
 

Similar to Composer, putting dependencies on the score (20)

Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
 
May The Nodejs Be With You
May The Nodejs Be With YouMay The Nodejs Be With You
May The Nodejs Be With You
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
 
Docker container management
Docker container managementDocker container management
Docker container management
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Laravel Day / Deploy
Laravel Day / DeployLaravel Day / Deploy
Laravel Day / Deploy
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
 

More from Rafael Dohms

The Individual Contributor Path - DPC2024
The Individual Contributor Path - DPC2024The Individual Contributor Path - DPC2024
The Individual Contributor Path - DPC2024
Rafael Dohms
 
Application Metrics - IPC2023
Application Metrics - IPC2023Application Metrics - IPC2023
Application Metrics - IPC2023
Rafael Dohms
 
How'd we get here? A guide to Architectural Decision Records
How'd we get here? A guide to Architectural Decision RecordsHow'd we get here? A guide to Architectural Decision Records
How'd we get here? A guide to Architectural Decision Records
Rafael Dohms
 
Architectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBRArchitectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBR
Rafael Dohms
 
Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)
Rafael Dohms
 
Application metrics - Confoo 2019
Application metrics - Confoo 2019Application metrics - Confoo 2019
Application metrics - Confoo 2019
Rafael Dohms
 
Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18
Rafael Dohms
 
Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18
Rafael Dohms
 
Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18
Rafael Dohms
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
Rafael Dohms
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
Rafael Dohms
 
Composer The Right Way - 010PHP
Composer The Right Way - 010PHPComposer The Right Way - 010PHP
Composer The Right Way - 010PHP
Rafael Dohms
 
Writing Code That Lasts - #Magento2Seminar, Utrecht
Writing Code That Lasts - #Magento2Seminar, UtrechtWriting Code That Lasts - #Magento2Seminar, Utrecht
Writing Code That Lasts - #Magento2Seminar, Utrecht
Rafael Dohms
 
Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16
Rafael Dohms
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
Rafael Dohms
 
Composer the Right Way - MM16NL
Composer the Right Way - MM16NLComposer the Right Way - MM16NL
Composer the Right Way - MM16NL
Rafael Dohms
 
Composer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRNComposer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRN
Rafael Dohms
 
Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16
Rafael Dohms
 
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
Rafael Dohms
 
A Journey into your Lizard Brain - PHP Conference Brasil 2015
A Journey into your Lizard Brain - PHP Conference Brasil 2015A Journey into your Lizard Brain - PHP Conference Brasil 2015
A Journey into your Lizard Brain - PHP Conference Brasil 2015
Rafael Dohms
 

More from Rafael Dohms (20)

The Individual Contributor Path - DPC2024
The Individual Contributor Path - DPC2024The Individual Contributor Path - DPC2024
The Individual Contributor Path - DPC2024
 
Application Metrics - IPC2023
Application Metrics - IPC2023Application Metrics - IPC2023
Application Metrics - IPC2023
 
How'd we get here? A guide to Architectural Decision Records
How'd we get here? A guide to Architectural Decision RecordsHow'd we get here? A guide to Architectural Decision Records
How'd we get here? A guide to Architectural Decision Records
 
Architectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBRArchitectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBR
 
Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)
 
Application metrics - Confoo 2019
Application metrics - Confoo 2019Application metrics - Confoo 2019
Application metrics - Confoo 2019
 
Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18
 
Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18
 
Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
 
Composer The Right Way - 010PHP
Composer The Right Way - 010PHPComposer The Right Way - 010PHP
Composer The Right Way - 010PHP
 
Writing Code That Lasts - #Magento2Seminar, Utrecht
Writing Code That Lasts - #Magento2Seminar, UtrechtWriting Code That Lasts - #Magento2Seminar, Utrecht
Writing Code That Lasts - #Magento2Seminar, Utrecht
 
Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
 
Composer the Right Way - MM16NL
Composer the Right Way - MM16NLComposer the Right Way - MM16NL
Composer the Right Way - MM16NL
 
Composer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRNComposer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRN
 
Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16
 
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
 
A Journey into your Lizard Brain - PHP Conference Brasil 2015
A Journey into your Lizard Brain - PHP Conference Brasil 2015A Journey into your Lizard Brain - PHP Conference Brasil 2015
A Journey into your Lizard Brain - PHP Conference Brasil 2015
 

Recently uploaded

Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
FilipTomaszewski5
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
DianaGray10
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
Sunil Jagani
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
Fwdays
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 

Recently uploaded (20)

Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 

Composer, putting dependencies on the score

  • 1. Rafael Dohms / @rdohms C!"p#$r Putting your dependencies on the score
  • 2. Rafael Dohms photo credit: Eli White @rdohms Evangelist, Speaker and Contributor. Developer at WEBclusive. Enabler at AmsterdamPHP.
  • 3. %$ E&$v'(!r P)(*+ a general introduction to Composer Ev$r,-', *!"p#)./ the basic stuff you need to know Up/r'-)./ (! ' M'$0(r! advanced features for more complex scenarios 1.-)./ ,!2r (2.$ discovering and sharing libraries
  • 5. per project system wide central repository spread out channels open acceptance strict standards
  • 6. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project
  • 7. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.:
  • 8. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.: PEAR
  • 9. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.: PEAR SVN Externals
  • 10. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.: PEAR SVN Externals Git Submodules
  • 11. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.: PEAR SVN Externals Git Submodules vendor management script
  • 12. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.: PEAR SVN Externals Git Submodules vendor management script C!"p#$r!
  • 13. A per-project dependency manager that allows you to declare a consistent list of dependencies and versions for your application, as well as a consistent way of sharing your libraries and making them discoverable using packagist.org
  • 15. I.0('&&)./ C!"p#$r Local (embed) $ curl -s http://getcomposer.org/installer | php Global $ curl -s http://getcomposer.org/installer | php -- --install-dir=bin
  • 16. I.0('&&)./ C!"p#$r Local (embed) $ curl -s http://getcomposer.org/installer | php Global $ curl -s http://getcomposer.org/installer | php -- --install-dir=bin 3p: $ ln -s /usr/bin/composer.phar /usr/bin/composer
  • 18. I.0('&&)./ C!"p#$r $ composer.phar --version Composer version 6573fd3
  • 19. I.0('&&)./ C!"p#$r php $ composer.phar --version Composer version 6573fd3
  • 21. K$$p )( 2p-'($-! $ composer.phar self-update Updating to version 65e95ed. Downloading: 100%
  • 23. C!"p#$r 101 $ cd ~/dev/myproject
  • 24. C!"p#$r 101 $ cd ~/dev/myproject $ vim composer.json { "require": { "silex/silex": "1.0.*" }, "minimum-stability": "dev" }
  • 25. C!"p#$r 101 $ cd ~/dev/myproject $ vim composer.json note: project root { "require": { "silex/silex": "1.0.*" }, "minimum-stability": "dev" }
  • 26. C!"p#$r 101 $ cd ~/dev/myproject $ vim composer.json note: project root “require”: required packages and { versions "require": { "silex/silex": "1.0.*" adv. ex.: >=1.0.0,<1.2-dev }, "minimum-stability": "dev" }
  • 27. C!"p#$r 101 $ cd ~/dev/myproject $ vim composer.json note: project root “require”: required packages and { versions "require": { "silex/silex": "1.0.*" adv. ex.: >=1.0.0,<1.2-dev }, "minimum-stability": "dev" “minimum-stability”: if you only } want stable packages default: stable
  • 28. C!"p#$r 101 $ cd ~/dev/myproject $ vim composer.json note: project root “require”: required packages and { versions "require": { "silex/silex": "1.0.*" adv. ex.: >=1.0.0,<1.2-dev }, "minimum-stability": "dev" “minimum-stability”: if you only } want stable packages default: stable $ composer.phar install
  • 29. Installing dependencies - Installing pimple/pimple (dev-master) Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be - Installing symfony/routing (dev-master) Cloning 6bca82c3ea0d42d750de4f49b22020dfd047dc0f [...] - Installing silex/silex (dev-master) Cloning 18e248a277adb061602d2bcabe96011db1c76ec0 symfony/routing suggests installing symfony/config (dev-master) symfony/routing suggests installing symfony/yaml (dev-master) symfony/routing suggests installing doctrine/common (>=2.2,<2.3) [...] silex/silex suggests installing symfony/browser-kit (2.1.*) silex/silex suggests installing symfony/css-selector (2.1.*) silex/silex suggests installing symfony/dom-crawler (2.1.*) Writing lock file Generating autoload files
  • 30. Installing dependencies - Installing pimple/pimple (dev-master) your Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be dependency’s - Installing symfony/routing (dev-master) dependencies Cloning 6bca82c3ea0d42d750de4f49b22020dfd047dc0f [...] - Installing silex/silex (dev-master) Cloning 18e248a277adb061602d2bcabe96011db1c76ec0 symfony/routing suggests installing symfony/config (dev-master) symfony/routing suggests installing symfony/yaml (dev-master) symfony/routing suggests installing doctrine/common (>=2.2,<2.3) [...] silex/silex suggests installing symfony/browser-kit (2.1.*) silex/silex suggests installing symfony/css-selector (2.1.*) silex/silex suggests installing symfony/dom-crawler (2.1.*) Writing lock file Generating autoload files
  • 31. Installing dependencies - Installing pimple/pimple (dev-master) your Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be dependency’s - Installing symfony/routing (dev-master) dependencies Cloning 6bca82c3ea0d42d750de4f49b22020dfd047dc0f [...] - Installing silex/silex (dev-master) your dependency Cloning 18e248a277adb061602d2bcabe96011db1c76ec0 symfony/routing suggests installing symfony/config (dev-master) symfony/routing suggests installing symfony/yaml (dev-master) symfony/routing suggests installing doctrine/common (>=2.2,<2.3) [...] silex/silex suggests installing symfony/browser-kit (2.1.*) silex/silex suggests installing symfony/css-selector (2.1.*) silex/silex suggests installing symfony/dom-crawler (2.1.*) Writing lock file Generating autoload files
  • 32. Installing dependencies - Installing pimple/pimple (dev-master) your Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be dependency’s - Installing symfony/routing (dev-master) dependencies Cloning 6bca82c3ea0d42d750de4f49b22020dfd047dc0f [...] - Installing silex/silex (dev-master) your dependency Cloning 18e248a277adb061602d2bcabe96011db1c76ec0 symfony/routing suggests installing symfony/config (dev-master) symfony/routing suggests installing symfony/yaml (dev-master) symfony/routing suggests installing doctrine/common (>=2.2,<2.3) [...] silex/silex suggests installing symfony/browser-kit (2.1.*) silex/silex suggests installing symfony/css-selector (2.1.*) silex/silex suggests installing symfony/dom-crawler (2.1.*) Writing lock file Generating autoload files suggestions of other packages, for further features
  • 33. P)*42p (+$ ($"p!! Let Composer bootstrap you development
  • 34. B!!(0(r'pp)./ Pr!5$*(0 $ composer.phar create-project fabpot/silex-skeleton ~/dev/myproject
  • 35. B!!(0(r'pp)./ Pr!5$*(0 $ composer.phar create-project fabpot/silex-skeleton ~/dev/myproject Installing fabpot/silex-skeleton (dev-master cc19d406cf3cac253715db92d400992d4f3e1b52) - Installing fabpot/silex-skeleton (dev-master) Cloning master Created project in one-liner/ Installing dependencies - Installing pimple/pimple (dev-master) Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be [...] symfony/routing suggests installing symfony/yaml (dev-master) [...] Writing lock file Generating autoload files
  • 36. B!!(0(r'pp)./ Pr!5$*(0 $ composer.phar create-project fabpot/silex-skeleton ~/dev/myproject Installing fabpot/silex-skeleton (dev-master cc19d406cf3cac253715db92d400992d4f3e1b52) - Installing fabpot/silex-skeleton (dev-master) Cloning master Created project in one-liner/ myproje Installing dependencies ct/ - Installing pimple/pimple (dev-master) compose r.json Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be compose r.lock config/ [...] console / src/ templat symfony/routing suggests installing symfony/yaml (dev-master) es/ vendor/ [...] web/ Writing lock file Generating autoload files
  • 37. I w'.( (! *!.(r)b2($ ' pr!5$*( Composer can set that up for you.
  • 38. B!!(0(r'pp)./ C!.(r)b2()!.0 $ composer.phar create-project dms/dms --dev ~/dev/oss/dms
  • 39. B!!(0(r'pp)./ C!.(r)b2()!.0 gimme dev packages $ composer.phar create-project dms/dms --dev ~/dev/oss/dms
  • 40. B!!(0(r'pp)./ C!.(r)b2()!.0 gimme dev packages $ composer.phar create-project dms/dms --dev ~/dev/oss/dms     "require-dev": {         "symfony/symfony": ">=2.1-dev",         "doctrine/orm": "dev-master"     },
  • 41. B!!(0(r'pp)./ C!.(r)b2()!.0 gimme dev packages $ composer.phar create-project dms/dms --dev ~/dev/oss/dms     "require-dev": {         "symfony/symfony": ">=2.1-dev",         "doctrine/orm": "dev-master"     }, “require-dev”: only needed if you are going to contribute
  • 42. H!w -! I 6.-/&!'- (+$ 6&$0? PSR-0 and the modern autoloader
  • 43. Composer generates an autoload file for all your dependencies
  • 44. Composer generates an autoload file for all your dependencies vendor/autoload.php
  • 45. "autoload": {     "psr-0": { "MyNamespace": "<root>" }, "classmap": ["src/", "lib/", "Something.php"], "files": ["src/MyLibrary/functions.php"] },
  • 46. “autoload”: describes the autoloading needed for your library "autoload": {     "psr-0": { "MyNamespace": "<root>" }, "classmap": ["src/", "lib/", "Something.php"], "files": ["src/MyLibrary/functions.php"] },
  • 47. “autoload”: describes the autoloading needed for your library "autoload": {     "psr-0": { "MyNamespace": "<root>" “psr-0”: PSR-0 Compatible libraries }, "classmap": ["src/", "lib/", "Something.php"], "files": ["src/MyLibrary/functions.php"] },
  • 48. “autoload”: describes the autoloading needed for your library "autoload": {     "psr-0": { "MyNamespace": "<root>" “psr-0”: PSR-0 Compatible libraries }, "classmap": ["src/", "lib/", "Something.php"], PEAR packages and “classmap”: Old other libraries "files": ["src/MyLibrary/functions.php"] },
  • 49. “autoload”: describes the autoloading needed for your library "autoload": {     "psr-0": { "MyNamespace": "<root>" “psr-0”: PSR-0 Compatible libraries }, "classmap": ["src/", "lib/", "Something.php"], PEAR packages and “classmap”: Old other libraries "files": ["src/MyLibrary/functions.php"] “files”: for php functions or initializations },
  • 50. I.0('&&)./, 2p-'()./ '.- "!v)./ !. how does Composer guarantee consistency
  • 51.
  • 53. “composer.json”: metadata and list of your dependencies. composer.json
  • 54. “composer.json”: metadata and list of your dependencies. composer.json composer.lock
  • 55. “composer.json”: metadata and list of your dependencies. composer.json composer.lock “composer.lock”: existing dependencies and current commit hashes.
  • 57. update composer.json composer.lock
  • 58. update install composer.json composer.lock
  • 59. update install reads composer.json composer.lock
  • 60. update install reads composer.json composer.lock gets latest
  • 61. update install reads composer.json writes composer.lock gets latest
  • 62. update install reads reads composer.json writes composer.lock gets latest
  • 63. update install reads reads composer.json compares writes composer.lock gets latest
  • 64. update install reads reads composer.json compares writes composer.lock gets latest gets locked version
  • 65. D$v$&!p)./ '. App ). ' ($'"? Commit you composer.lock file into the repository, and use composer install.
  • 66. D$v$&!p)./ '. App ). ' ($'"? Commit you composer.lock file into the repository, and use composer install. will ensure everyone is on the same “page”
  • 67. I’" -$v$&!p)./ ' &)br'r,, +$&p! here are some fields you should care about
  • 68. { "name": "vendor-namespace/package-name", "type": "symfony-bundle", "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", "support": { "email": "support@mylib.com", "issues": "http://issues.lib.com" } "target-dir": "/folder/to/install", }
  • 69. “name”: this should be unique, pick a good one! { "name": "vendor-namespace/package-name", "type": "symfony-bundle", "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", "support": { "email": "support@mylib.com", "issues": "http://issues.lib.com" } "target-dir": "/folder/to/install", }
  • 70. “name”: this should be unique, pick a good one! { "name": "vendor-namespace/package-name", “type”: will be used for more "type": "symfony-bundle", advanced “custom”installs "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", "support": { "email": "support@mylib.com", "issues": "http://issues.lib.com" } "target-dir": "/folder/to/install", }
  • 71. “name”: this should be unique, pick a good one! { "name": "vendor-namespace/package-name", “type”: will be used for more "type": "symfony-bundle", advanced “custom”installs "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", “license”: very important! "support": { "email": "support@mylib.com", "issues": "http://issues.lib.com" } "target-dir": "/folder/to/install", }
  • 72. “name”: this should be unique, pick a good one! { "name": "vendor-namespace/package-name", “type”: will be used for more "type": "symfony-bundle", advanced “custom”installs "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", “license”: very important! "support": { “support”: point people the right "email": "support@mylib.com", "issues": "http://issues.lib.com" way. } "target-dir": "/folder/to/install", }
  • 73. “name”: this should be unique, pick a good one! { "name": "vendor-namespace/package-name", “type”: will be used for more "type": "symfony-bundle", advanced “custom”installs "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", “license”: very important! "support": { “support”: point people the right "email": "support@mylib.com", "issues": "http://issues.lib.com" way. } "target-dir": "/folder/to/install", } “target-dir”: great for installing sub-dir splits repositories ex: Symfony Bundles: /Acme/Bundle/MyBundle
  • 74. M, *!-$ )0 PHP 5.4 !.&,! managing system dependencies
  • 75. { "require": { "php": ">=5.3.3", "ext-ldap": "*" } }
  • 76. { “php”: PHP version. "require": { "php": ">=5.3.3", "ext-ldap": "*" } }
  • 77. { “php”: PHP version. "require": { "php": ">=5.3.3", "ext-ldap": "*" } “ext-*”: Presence of selected } extension
  • 78. Up/r'-)./ (! ' M'$0(r!
  • 79. B2( I .$$- ' 0p$*)6* v$r0)!. version modifiers to the rescue!
  • 80.
  • 82. “#<ref>”: Get this specific commit "acme/foo": "1.0.x-dev#3ebbe75"
  • 83. “#<ref>”: Get this specific commit "acme/foo": "1.0.x-dev#3ebbe75" "acme/foo": "@dev" "acme/foo": "1.0.*@beta"
  • 84. “#<ref>”: Get this specific commit "acme/foo": "1.0.x-dev#3ebbe75" "acme/foo": "@dev" "acme/foo": "1.0.*@beta" “@<state>”: Get a version outside your default stability
  • 85. I .$$- (! 7$*2($ ' f$w 0*r)p(0 how to automate tasks with Composer
  • 86.     "scripts": {         "post-install-cmd": [             "SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap",             "SensioBundleDistributionBundleComposerScriptHandler::clearCache",             "SensioBundleDistributionBundleComposerScriptHandler::installAssets",             "SensioBundleDistributionBundleComposerScriptHandler::installRequirementsFile"         ],         "post-update-cmd": [             "SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap",             "SensioBundleDistributionBundleComposerScriptHandler::clearCache",             "SensioBundleDistributionBundleComposerScriptHandler::installAssets",             "SensioBundleDistributionBundleComposerScriptHandler::installRequirementsFile"         ]     },
  • 87. “scripts”: allows you to run scripts at given moments     "scripts": {         "post-install-cmd": [             "SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap",             "SensioBundleDistributionBundleComposerScriptHandler::clearCache",             "SensioBundleDistributionBundleComposerScriptHandler::installAssets",             "SensioBundleDistributionBundleComposerScriptHandler::installRequirementsFile"         ],         "post-update-cmd": [             "SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap",             "SensioBundleDistributionBundleComposerScriptHandler::clearCache",             "SensioBundleDistributionBundleComposerScriptHandler::installAssets",             "SensioBundleDistributionBundleComposerScriptHandler::installRequirementsFile"         ]     },
  • 88. C20(!" R$p#)(!r)$0 !r .! C!"p#$r, w+'( .!w? Injecting Composer into wild packages
  • 93. “hero/superpackage”: “dev-master”     "repositories": [ { "type": "vcs", "url": "https://github.com/rdohms/hero-superpackage" }        ]
  • 94. “hero/superpackage”: “dev-master” “repositories”: point to non-indexed, override existing or on- the-fly packages     "repositories": [ { "type": "vcs", "url": "https://github.com/rdohms/hero-superpackage" }        ]
  • 95. N!.-C!"p#$r P'*4'/$ { "repositories": [ { "type": "package", "package": { "name": "smarty/smarty", "version": "3.1.7", "dist": { "url": "http://www.smarty.net/files/Smarty-3.1.7.zip", "type": "zip" }, "source": { "url": "http://smarty-php.googlecode.com/svn/", "type": "svn", "reference": "tags/Smarty_3_1_7/distribution/" } } } ] }
  • 96. N!.-C!"p#$r P'*4'/$ { "repositories": [ “package”: on-the-fly package, injecting a { composer.json "type": "package", "package": { "name": "smarty/smarty", "version": "3.1.7", "dist": { "url": "http://www.smarty.net/files/Smarty-3.1.7.zip", "type": "zip" }, "source": { "url": "http://smarty-php.googlecode.com/svn/", "type": "svn", "reference": "tags/Smarty_3_1_7/distribution/" } } } ] }
  • 97. N!.-C!"p#$r P'*4'/$ { "repositories": [ “package”: on-the-fly package, injecting a { composer.json "type": "package", "package": { "name": "smarty/smarty", "version": "3.1.7", "dist": { "url": "http://www.smarty.net/files/Smarty-3.1.7.zip", "type": "zip" SVN / Git }, "source": { "url": "http://smarty-php.googlecode.com/svn/", "type": "svn", "reference": "tags/Smarty_3_1_7/distribution/" } } } ] }
  • 98. I .$$- (+)0 PEAR p'*4'/$... No Problem!
  • 99. { "repositories": [ { "type": "pear", "url": "http://pear2.php.net" } ], "require": { "pear-pear2.php.net/PEAR2_Text_Markdown": "*", "pear-pear2/PEAR2_HTTP_Request": "*" } }
  • 100. { “pear”: official PEAR and custom PEAR "repositories": [ channels { "type": "pear", "url": "http://pear2.php.net" } ], "require": { "pear-pear2.php.net/PEAR2_Text_Markdown": "*", "pear-pear2/PEAR2_HTTP_Request": "*" } }
  • 101. { “pear”: official PEAR and custom PEAR "repositories": [ channels { "type": "pear", "url": "http://pear2.php.net" } ], "require": { "pear-pear2.php.net/PEAR2_Text_Markdown": "*", "pear-pear2/PEAR2_HTTP_Request": "*" } } Remember the prefix!
  • 102. { “pear”: official PEAR and custom PEAR "repositories": [ channels { "type": "pear", "url": "http://pear2.php.net" } ], "require": { "pear-pear2.php.net/PEAR2_Text_Markdown": "*", "pear-pear2/PEAR2_HTTP_Request": "*" } } Remember the prefix! !! Warning: PEAR causes a overhead of requests
  • 103. alias replace provide
  • 104. alias { "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "require": { "monolog/monolog": "dev-bugfix as 1.0.x-dev" } } replace provide
  • 105. alias { "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "require": { "monolog/monolog": "dev-bugfix as 1.0.x-dev" } } replace provide “replace”: allows you to replace other packages, and be used them in their place.
  • 106. alias { "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "require": { "monolog/monolog": "dev-bugfix as 1.0.x-dev" } } replace provide “replace”: allows you to “provide”: allows you to say replace other packages, and a package provides a be used them in their place. expectation.
  • 108. I .$$- ' &)br'r, (+'( -!$0.. Let me get that for you
  • 110. usage info package info versions
  • 112. $ composer.phar search filter dms/dms-filter-bundle : DMS Filter Bundle, makes Annotation based ... lexik/form-filter-bundle : This bundle aim to provide classes to build... rollerworks/recordfilter-bundle : Record search-filtering bundle for Symfony brikou/zend_filter : Zend Framework Filter Library ext-filter : The filter PHP extension dms/dms-filter : DMS Library, includes various bundles and ... shtumi/useful-bundle : Symfony ShtumiUsefulBundle
  • 113. $ composer.phar show dms/dms-filter-bundle
  • 114. $ composer.phar show dms/dms-filter-bundle name : dms/dms-filter-bundle descrip. : DMS Filter Bundle, makes Annotation based entity filtering available in Symfony keywords : symfony, bundle, filter, dms versions : dev-master, v1.1.1, v1.1, 1.0.2, 1.0.1, 1.0.0 type : symfony-bundle license : MIT source : [git] https://github.com/rdohms/DMSFilterBundle v1.1.1 dist : [zip] https://github.com/rdohms/DMSFilterBundle/zipball/ v1.1.1 v1.1.1 names : dms/dms-filter-bundle autoload psr-0 DMSBundleFilterBundle => . requires php >=5.3.2 dms/dms-filter >=1.0.2
  • 115. B2( ", r$p#)(!r, )0 pr)v'($! Get your own package repository
  • 116. S'()0!
  • 117. R!&&!2( ,!2r !w. S'()0 $ composer.phar create-project composer/satis
  • 118. R!&&!2( ,!2r !w. S'()0 $ composer.phar create-project composer/satis $ vi packages.json { "name": "My Repository", "homepage": "http://packages.example.org", "repositories": [ { "type": "vcs", "url": "http://github.com/mycompany/privaterepo" }, { "type": "vcs", "url": "http://svn.example.org/private/repo" }, { "type": "vcs", "url": "http://github.com/mycompany/privaterepo2" } ], "require-all": true }
  • 119. R!&&!2( ,!2r !w. S'()0 $ composer.phar create-project composer/satis $ vi packages.json { "name": "My Repository", "homepage": "http://packages.example.org", "repositories": [ { "type": "vcs", "url": "http://github.com/mycompany/privaterepo" }, { "type": "vcs", "url": "http://svn.example.org/private/repo" }, { "type": "vcs", "url": "http://github.com/mycompany/privaterepo2" } ], "require-all": true } $ php bin/satis build config.json web/
  • 120. U0)./ ,!2r !w. S'()0 { "repositories": [ { "type": "composer", "url": "http://packages.yourdomain.net" } ], “require”: { “myvendor/mypackage”: “dev-master” } }
  • 121. U0)./ ,!2r !w. S'()0 { "repositories": [ “composer”: use this just like it was Packagist { "type": "composer", "url": "http://packages.yourdomain.net" } ], “require”: { “myvendor/mypackage”: “dev-master” } }
  • 122. W+$r$ 0+!2&- I /$( +$&p? http://getcomposer.org #composer on irc.freenode.org
  • 123. %$ E&$v'(!r P)(*+ Dependency Manager, consistent versions, per-project Ev$r,-', *!"p#)./ install, update, lock and autoload Up/r'-)./ (! ' M'$0(r! post-install, overriding, PEAR integration, developer environment 1.-)./ ,!2r (2.$ Satis and Packagist
  • 124. %'.4 ,!2! https://joind.in/7051 @rdohms http://doh.ms http://slides.doh.ms