Skip to content

Instantly share code, notes, and snippets.

@K-Phoen
Last active December 20, 2015 09:29
Show Gist options
  • Save K-Phoen/6108012 to your computer and use it in GitHub Desktop.
Save K-Phoen/6108012 to your computer and use it in GitHub Desktop.
Introduction à Composer - Partie 2
{
"require": {
"propel/propel-service-provider": ">=0.0.1",
"propel/propel1": "1.6.*",
"silex/silex": "1.0.*",
"symfony/validator": "2.1.*",
"willdurand/hateoas": "0.0.*",
"symfony/property-access": "2.2.*",
"symfony/yaml": "2.2.*",
"jms/metadata": "1.2.*",
"jms/serializer": "1.0.*"
},
"autoload": {
"psr-0": { "Propilex": "src" }
}
}
% php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing phpoption/phpoption (1.1.0)
Downloading: 100%
- Installing phpcollection/phpcollection (0.1.0)
Downloading: 100%
- Installing doctrine/common (2.3.0)
Loading from cache
- Installing jms/parser-lib (1.0.0)
Downloading: 100%
- Installing jms/metadata (1.2.0-RC)
Loading from cache
- Installing jms/serializer (dev-master 71388cc)
Cloning 71388cc58d4c146136ff7e32d9691562ddd5ae99
[...]
Generating autoload files
cd /path/to/your/project
curl -s http://getcomposer.org/installer | php
% php composer.phar autoload
{
"require": {
"propel/propel-service-provider": ">=0.0.1",
"propel/propel1": "1.6.*",
"silex/silex": "1.0.*",
"symfony/validator": "2.1.*",
"willdurand/hateoas": "0.0.*",
"symfony/property-access": "2.2.*",
"symfony/yaml": "2.2.*",
"jms/metadata": "1.2.*",
"jms/serializer": "1.0.*"
}
}
% php composer.phar install
% php composer.phar require "vendor/package" "dev-master"
{
"require": {
"propel/propel-service-provider": ">=0.0.1",
"propel/propel1": "1.6.*",
"silex/silex": "1.0.*",
"symfony/validator": "2.1.*",
"willdurand/hateoas": "0.0.*",
"symfony/property-access": "2.2.*",
"symfony/yaml": "2.2.*",
"jms/metadata": "1.2.*",
"jms/serializer": "1.0.*"
},
"autoload": {
"psr-0": { "Propilex": "src" }
},
"repositories": [ { "type": "composer", "url": "http://satis.mycompany.com/" } ]
}
% php composer.phar update "vendor/package"
<?php
require 'vendor/autoload.php';
// ou dans un bootstrap de tests
$loader = require 'vendor/autoload.php';
$loader->add('Acme\\Test\\', __DIR__);
vendor
├── autoload.php
├── composer
│   └── [..]
├── doctrine
│   └── common
├── jms
│   ├── metadata
│   ├── parser-lib
│   └── serializer
├── [...]
└── willdurand
└── hateoas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment