forked from jolicode/composer-cheatsheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
434 lines (413 loc) · 39.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Composer.json Schema CheatSheet - Dependency Manager for PHP</title>
<meta name="description" content="Fancy cheatsheet for Composer, the dependency manager of PHP" />
<meta name="keywords" content="help, documentation, cheat sheet, composer" />
<link rel="stylesheet" type="text/css" href="bootstrap.css?v2">
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
var schema = '';
var hints = {
"home": "This is an interactive guide for exploring various important properties of the <a href='http://composer.json.jolicode.com/'>composer.json</a> file from <a href='http://getcomposer.org'>Composer</a>. <br/> <br/> You can access information about properties by <strong>mousing over</strong>.",
"name": "<p>The name of the package. It consists of vendor name and project name, separated by <code>/</code>.</p><br /><br />Examples:<br /><br />monolog/monolog<br />igorw/event-source<br />Required for published packages (libraries).",
"description": "A short description of the package. Usually this is just one line long.<br /><br />Required for published packages (libraries).",
"version": "This must follow the format of <code>X.Y.Z</code> with an optional suffix of <code>-dev</code>, <code>alphaN</code>, <code>-betaN</code> or <code>-RCN</code>.<br /><br />Examples:<br /><br /><pre><code>1.0.0<br />1.0.2<br />1.1.0<br />0.2.5<br />1.0.0-dev<br />1.0.0-beta2<br />1.0.0-RC5<br /><br /></code></pre>Optional if the package repository can infer the version from somewhere, such as the VCS tag name in the VCS repository. In that case it is also recommended to omit it.",
"type": "<p>Package types are used for custom installation logic. If you have a package that needs some special logic, you can define a custom type. This could be a <code>symfony-bundle</code>, a <code>wordpress-plugin</code> or a <code>typo3-module</code>. These types will all be specific to certain projects, and they will need to provide an installer capable of installing packages of that type.</p>",
"keywords": "An array of keywords that the package is related to. These can be used for searching and filtering.",
"homepage": "An URL to the website of the project.",
"time": "Release date of the version.<br />Must be in <code>YYYY-MM-DD</code>, <code>YYYY-MM-DD HH:MM:SS</code> or <code>YYYY-MM-DDTHH:MM:SSZ</code> format.",
"license": "The license of the package. This can be either a string or an array of strings.<br />The recommended notation for the most common licenses is (alphabetical):<br /><code>Apache-2.0<br />BSD-2-Clause<br />BSD-3-Clause<br />BSD-4-Clause<br />GPL-2.0<br />GPL-2.0+<br />GPL-3.0<br />GPL-3.0+<br />LGPL-2.1<br />LGPL-2.1+<br />LGPL-3.0<br />LGPL-3.0+<br />MIT</code><br />For closed-source software, you may use <code>proprietary</code> as the license identifier.",
"authors": "The authors of the package. This is an array of objects.",
"authors-name": "The author's name. Usually his real name.",
"authors-email": "The author's email address.",
"authors-homepage": "An URL to the author's website.",
"authors-role": "The authors' role in the project (e.g. developer or translator)",
"support": "Various information to get support about the project.",
"support-email" : "Email address for support.",
"support-issues" : "URL to the Issue Tracker.",
"support-forum" : "URL to the Forum.",
"support-wiki" : "URL to the Wiki.",
"support-irc" : "IRC channel for support, as irc://server/channel.",
"support-source" : "URL to browse or download the sources.",
"require": "Lists packages required by this package. The package will not be installed unless those requirements can be met.<br />It take an object which maps package names to <a href=\"http://getcomposer.org/doc/01-basic-usage.md#package-versions\">version constraints</a>. <br/><code>require</code> and <code>require-dev</code> additionally support stability flags (root-only). These allow you to further restrict or expand the stability of a package beyond the scope of the <a href=\"http://getcomposer.org/doc/#minimum-stability\">minimum-stability</a> setting. You can apply them to a constraint, or just apply them to an empty constraint if you want to allow unstable packages of a dependency's dependency for example.<br /><code>require</code> and <code>require-dev</code> additionally support explicit references (i.e. commit) for dev versions to make sure they are blocked to a given state, even when you run update. These only work if you explicitly require a dev version and append the reference with <code>#<ref></code>.",
"require-dev": "Lists packages required for developing this package, or running tests, etc. The dev requirements of the root package only will be installed if <code>install</code> or <code>update</code> is ran with <code>--dev</code>.<br />Packages listed here and their dependencies can not overrule the resolution found with the packages listed in require. This is even true if a different version of a package would be installable and solve the conflict. The reason is that <code>install --dev</code> produces the exact same state as just <code>install</code>, apart from the additional dev packages.<br />If you run into such a conflict, you can specify the conflicting package in the require section and require the right version number to resolve the conflict.",
"conflict": "Lists packages that conflict with this version of this package. They will not be allowed to be installed together with your package.",
"replace": "Lists packages that are replaced by this package. This allows you to fork a package, publish it under a different name with its own version numbers, while packages requiring the original package continue to work with your fork because it replaces the original package.<br /><br />This is also useful for packages that contain sub-packages, for example the main symfony/symfony package contains all the Symfony Components which are also available as individual packages. If you require the main package it will automatically fulfill any requirement of one of the individual components, since it replaces them.<br /><br />Caution is advised when using replace for the sub-package purpose explained above. You should then typically only replace using <code>self.version</code> as a version constraint, to make sure the main package only replaces the sub-packages of that exact version, and not any other version, which would be incorrect.",
"provide": "List of other packages that are provided by this package. This is mostly useful for common interfaces. A package could depend on some virtual <code>logger</code> package, any library that implements this logger interface would simply list it in <code>provide</code>.",
"suggest": "Suggested packages that can enhance or work well with this package. These are just informational and are displayed after the package is installed, to give your users a hint that they could add more packages, even though they are not strictly required.<br />The format is like package links above, except that the values are free text and not version constraints.",
"autoload": "Autoload mapping for a PHP autoloader.<br/><br/>Currently <a href=\"http://www.php-fig.org/psr/psr-4/\">PSR-4</a> autoloading, <a href=\"https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md\">PSR-0</a> autoloading, classmap generation and files are supported. PSR-4 is the recommended way though since it offers greater ease of use (no need to regenerate the autoloader when you add classes).<br /><br />Under the <code>psr-4</code> key you define a mapping from namespaces to paths, relative to the package root. When autoloading a class like <code>Foo\\Bar\\Baz</code> a namespace prefix <code>Foo\\</code> pointing to a directory <code>src/</code> means that the autoloader will look for a file named <code>src/Bar/Baz.php</code> and include it if present. Note that as opposed to the older PSR-0 style, the prefix (<code>Foo\\</code>) is not present in the file path.<br /><br />Under the <code>psr-0</code> key you define a mapping from namespaces to paths, relative to the package root. Note that this also supports the PEAR-style non-namespaced convention.",
"autoload-dev": "Same as \"autoload\", but only considered in development mode.",
"target-dir": "DEPRECATED: Defines the installation target.<br /><br />In case the package root is below the namespace declaration you cannot autoload properly. target-dir solves this problem.<br /><br />An example is Symfony. There are individual packages for the components. The Yaml component is under <code>Symfony\\Component\\Yaml</code>. The package root is that Yaml directory. To make autoloading possible, we need to make sure that it is not installed into <code>vendor/symfony/yaml</code>, but instead into <code>vendor/symfony/yaml/Symfony/Component/Yaml</code>, so that the autoloader can load it from <code>vendor/symfony/yaml</code>.",
"minimum-stability": "This defines the default behavior for filtering packages by stability. This defaults to <code>stable</code>, so if you rely on a <code>dev</code> package, you should specify it in your file to avoid surprises.<br />All versions of each package are checked for stability, and those that are less stable than the <code>minimum-stability</code> setting will be ignored when resolving your project dependencies. Specific changes to the stability requirements of a given package can be done in <code>require</code> or <code>require-dev</code>.Available options are <code>dev</code>, <code>alpha</code>, <code>beta</code>, <code>RC</code>, and <code>stable</code>.",
"repositories": "Custom package repositories to use.<br />By default composer just uses the packagist repository. By specifying repositories you can get packages from elsewhere.<br />The following repository types are supported:<br /><ul><li><strong>composer:</strong> A composer repository is simply a <code>packages.json</code> file served via HTTP, that contains a list of <code>composer.json</code> objects with additional <code>dist</code> and/or <code>source</code> information.</li> <li><strong>vcs:</strong> The version control system repository can fetch packages from git, svn and hg repositories.</li><li><strong>pear:</strong> With this you can import any pear repository into your composer project.</li><li><strong>package:</strong> If you depend on a project that does not have any support for composer whatsoever you can define the package inline using a <code>package</code> repository. You basically just inline the <code>composer.json</code> object.</li></ul>",
"repositories-composer-type": "The main repository type is the <code>composer</code> repository. It uses a single <code>packages.json</code> file that contains all of the package metadata.<br />This is also the repository type that packagist uses. To reference a <code>composer</code> repository, just supply the path before the <code>packages.json</code> file. In case of packagist, that file is located at <code>/packages.json</code>, so the URL of the repository would be <code>packagist.org</code>. For <code>example.org/packages.json</code> the repository URL would be <code>example.org</code>.<br/>See the <a href=\"http://getcomposer.org/doc/05-repositories.md#composer\">full documentation</a>.",
"repositories-vcs-type": "VCS stands for version control system. This includes versioning systems like git, svn or hg. Composer has a repository type for installing packages from these systems.<br/>See the <a href=\"http://getcomposer.org/doc/05-repositories.md#vcs\">full documentation</a>.",
"repositories-pear-type": "It is possible to install packages from any PEAR channel by using the <code>pear</code> repository. Composer will prefix all package names with <code>pear-{channelName}/</code> to avoid conflicts. All packages are also aliased with prefix <code>pear-{channelAlias}/</code>.<br/>See the <a href=\"http://getcomposer.org/doc/05-repositories.md#pear\">full documentation</a>.",
"repositories-package-type": "If you want to use a project that does not support composer through any of the means above, you still can define the package yourself by using a <code>package</code> repository.<br />Basically, you define the same information that is included in the <code>composer</code> repository's <code>packages.json</code>, but only for a single package. Again, the minimum required fields are <code>name</code>, <code>version</code>, and either of <code>dist</code> or <code>source</code>.<br/>See the <a href=\"http://getcomposer.org/doc/05-repositories.md#package\">full documentation</a>.",
"config": "A set of configuration options. It is only used for projects.",
"config-vendor-dir": "The location where all packages are installed.",
"config-bin-dir": "The location where all binaries are linked.",
"config-process-timeout": "The timeout in seconds for process executions, defaults to 300 (5mins).",
"config-notify-on-install": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour.",
"config-github-protocols": "A list of protocols to use for github.com clones, in priority order.",
"config-use-include-path": "If true, the Composer autoloader will also look for classes in the PHP include path.",
"config-preferred-install": "Can be any of <code>source</code>, <code>dist</code> or <code>auto</code>. This option allows you to set the install method Composer will prefer to use.",
"config-github-oauth": "A list of domain names and oauth keys. Oauthtoken is used to access private repositories on github and to circumvent the low IP-based rate limiting of their API.",
"config-http-basic": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
"config-store-auths": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt.",
"config-cache-dir": "Stores all the caches used by composer. See also <a href=\"http://getcomposer.org/doc/03-cli.md#composer-home\">COMPOSER_HOME</a>.",
"config-cache-files-dir": "Stores the zip archives of packages.",
"config-cache-repo-dir": "Stores repository metadata for the composer type and the VCS repos of type svn, github and bitbucket.",
"config-cache-vcs-dir": "Stores VCS clones for loading VCS repository metadata for the git/hg types and to speed up installs.",
"config-cache-files-ttl": "Composer caches all dist (zip, tar, ...) packages that it downloads. Those are purged after six months of being unused by default. This option allows you to tweak this duration (in seconds) or disable it completely by setting it to 0.",
"config-cache-files-maxsize": "Composer caches all dist (zip, tar, ...) packages that it downloads. When the garbage collection is periodically ran, this is the maximum size the cache will be able to use. Older (less used) files will be removed first until the cache fits.",
"config-discard-changes": "Can be any of <code>true</code>, <code>false</code> or <code>stash</code>. This option allows you to set the default style of handling dirty updates when in non-interactive mode. true will always discard changes in vendors, while <code>stash</code> will try to stash and reapply. Use this for CI servers or deploy scripts if you tend to have modified vendors.",
"config-autoloader-suffix": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated.",
"config-optimize-autoloader": "Always optimize when dumping the autoloader.",
"config-prepend-autoloader": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true.",
"config-github-domains": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
"scripts": "Composer allows you to hook into various parts of the installation process through the use of scripts.<br />A script is a callback (defined as a static method) or a shell command that will be called when the event it listens on is triggered.<br/> Let's take a look to the full list of <a href=\"http://getcomposer.org/doc/articles/scripts.md#event-types\">Event Types</a>.",
"extra": "Arbitrary extra data for consumption by <code>scripts</code>.<br />This can be virtually anything. To access it from within a script event handler, you can do:<br /><pre><code>$extra = $event->getComposer()->getPackage()->getExtra();</code></pre>",
"bin": "A set of files that should be treated as binaries and symlinked into the <code>bin-dir</code> (from config).",
"archive": "Options for creating package archives.<br />The example will include <code>/dir/foo/bar/file</code>, <code>/foo/bar/baz</code>, <code>/file.php</code>, <code>/foo/my.test</code> but it will exclude <code>/foo/bar/any</code>, <code>/foo/baz</code>, and <code>/my.test</code>.",
"prefer-stable": "When this is enabled, Composer will prefer more stable packages over unstable ones when finding compatible stable packages is possible. If you require a dev version or only alphas are available for a package, those will still be selected granted that the minimum-stability allows for it.",
"phar-init": "Creates a basic <code>composer.json</code> file in current directory.<br/><br/>When you run the command it will interactively ask you to fill in the fields, while using some smart defaults.",
"phar-create-project": "Create new project from a package into given directory.",
"phar-search": "Search for packages.<br /><br />The search command allows you to search through the current project's package repositories. Usually this will be just packagist. You simply pass it the terms you want to search for.",
"phar-require": "Adds required packages to your composer.json and installs them.<br /><br/>The <code>require</code> command adds new packages to the <code>composer.json</code> file from the current directory.<br/>After adding/changing the requirements, the modified requirements will be installed or updated.",
"phar-install": "Parses the composer.json file and downloads the needed dependencies.<br/><br/>The <code>install</code> command reads the <code>composer.json</code> file from the current directory, resolves the dependencies, and installs them into <code>vendor</code>.<br/>If there is no <code>composer.lock</code> file, composer will create one after dependency resolution. The <code>--no-scripts</code> option is useful to bypass the configured pre and post scripts.",
"phar-update": "Updates your dependencies to the latest version, and updates the composer.lock file.<br/><br/>In order to get the latest versions of the dependencies and to update the <code>composer.lock</code> file, you should use the <code>update</code> command.<br/>This will resolve all dependencies of the project and write the exact versions into <code>composer.lock</code>.",
"phar-validate": "Validates a composer.json.<br/><br/>You should always run the <code>validate</code> command before you commit your <code>composer.json</code> file, and before you tag a release. It will check if your <code>composer.json</code> is valid.",
"phar-self-update": "Update <code>composer.phar</code> to the lastest version.<br/><br/>Running the <code>self-update</code> command could solve some problems and save you some time too.<br/><br/>You can also use the <code>selfupdate</code> alias.",
"phar-status": "If you often need to modify the code of your dependencies and they are installed from source, the status command allows you to check if you have local changes in any of them.",
"phar-config": "Allows you to edit some basic composer settings in either the local composer.json file or the global config.json file.",
"phar-show": "List all of the available packages, you can use the show command like this <code>show -v symfony/symfony</code> to list the available versions.",
"phar-depends": "Tell you which other packages depend on a certain package. You can specify which link types (require, require-dev) should be included in the listing. By default both are used.",
"phar-dump-autoload": "If you need to update the autoloader because of new classes in a classmap package for example, you can use \"dump-autoload\" to do that without having to go through an install or update.<br /><br />Use <b>--optimize</b> to convert PSR-0 autoloading to classmap to get a faster autoloader. <strong>This is strongly recommended for production (you can get a 20% boost)</strong>, but can take a bit of time to run so it is currently not done by default.<br/><br/>You can also use the <code>dumpautoload</code> alias.",
"phar-diagnose": "If you think you found a bug, or something is behaving strangely, you might want to run the diagnose command to perform automated checks for many common problems.",
"phar-help": "Display help for all the other commands: <code>composer.phar help install</code>.",
"phar-run-script": "Run the scripts manually, just give it the script name and optionally <code>--no-dev</code> to disable the dev mode.",
"phar-global": "The global command allows you to run other commands like <code>install</code>, <code>require</code> or <code>update</code> as if you were running them from the <code>COMPOSER_HOME</code> directory.<br /><br />This can be used to install CLI utilities globally and if you add <code>$COMPOSER_HOME/vendor/bin</code> to your <code>$PATH</code> environment variable.<br /><code>$ php composer.phar global require fabpot/php-cs-fixer:dev-master</code><br />Now the <code>php-cs-fixer</code> binary is available globally (assuming you adjusted your PATH).",
"phar-licenses": "Show information about licenses of dependencies.",
"phar-archive": "Create an archive of this composer package.",
"phar-browse": "Aliased to <code>home</code>, opens the package's repository URL or homepage in your browser.",
"phar-clear-cache": "Aliased to <code>clearcache</code>, clears composer's internal package cache.",
"phar-list": "Lists commands",
"phar-remove": "Removes a package from the require or require-dev: <code>remove vendor/package vendor/package2</code>.",
"phar-about": "Short information about Composer."
};
$(document).ready(function(){
$.get('composer-schema.json', function(data){
schema = data;
}, 'json');
$('.hint').html(hints['home']);
$('.composer .pair').mouseover(function(e){
var el = this;
var topPx = $("#header").height() + 61;
if ($(document).scrollTop() >= topPx) {
topPx = $(document).scrollTop();
}
$('.doc').css('top', topPx + 'px')
var prefix = (undefined != $('.key', el).attr('data-prefix'))? $('.key', el).attr('data-prefix'):'';
var title = $('.key', el).html().replace(/"/g, '');
var key = prefix+title;
$('.title').html(title);
if (schema && (undefined != schema['properties'][key])) {
var typeData = '';
if (undefined != schema['properties'][key]['type']) {
typeData = schema['properties'][key]['type'];
if (typeData.constructor.toString().indexOf("Array") > -1) {
typeData = typeData.join(', ');
}
}
$('.type').html(typeData);
} else {
$('.type').html('');
}
$('.hint').html(hints[key]);
});
});
</script>
<style type="text/css">
#header p {
font-weight: normal;
font-size: 18px;
line-height: 32px;
}
.composer .pair {
cursor:pointer;
}
.composer .pair:hover {
background-color:white;
}
.pair {
padding:0px;
margin:0px;
}
.doc {
position:absolute;
#top:50px;
font-size:18px;
width:400px;
line-height:32px;
}
.title {
font-weight: bold;
}
.type {
font-size: 17px;
font-style: italic;
}
code {
border: 1px solid #ccc;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
padding: 0px 4px;
display: inline-block;
line-height: 125%;
margin: 0 2px;
}
</style>
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">composer.json cheat sheet</a>
</div>
</div>
</div>
<div class="container">
<div class="content">
<div class="row">
<div class="span12" id="header">
<h2>Composer Cheat Sheet for developers</h2>
<p>Composer is the dependency manager for PHP and you are on a one-page-only documentation for this tool.<br />
Official documentation is on the <a href="http://getcomposer.org">official website</a>,
this page just brings you the essential.</p>
</div>
</div>
<div class="row">
<div class="span7">
<h3>One line installer</h3>
<pre><code>curl -sS https://getcomposer.org/installer | php</code></pre>
</div>
</div>
<div class="row" id="documentation">
<div class="span7">
<h2>composer.phar command line</h2>
<pre class="composer">
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">about</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">archive</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">browse</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">clear-cache</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">config</span> <span class="value">--list</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">create-project</span> <span class="value">symfony/framework-standard-edition dir/</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">depends</span> <span class="value">vendor-name/package-name</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">diagnose</span></span>
<span class="pair"><strong>$ php composer.phar <span class="key" data-prefix="phar-">dump-autoload</span> --optimize</strong></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">global</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">help</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">init</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">install</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">licenses</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">list</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">remove</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">require</span> <span class="value">vendor-name/package-name</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">run-script</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">search</span> <span class="value">my keywords</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">self-update</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">show</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">status</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">update</span></span>
<span class="pair">$ php composer.phar <span class="key" data-prefix="phar-">validate</span></span>
</pre>
<h2>composer.json file</h2>
<pre class="composer">
{
<span class="pair"><span class="key">"name"</span>: <span class="value">"vendor-name/project-name"</span>,</span>
<span class="pair"><span class="key">"description"</span>: <span class="value">"This is a very cool package!"</span>,</span>
<span class="pair"><span class="key">"version"</span>: "0.3.0",</span>
<span class="pair"><span class="key">"type"</span>: <span class="value">"library"</span></span>,
<span class="pair"><span class="key">"keywords"</span>: <span class="value">["logging", "cool", "awesome"]</span></span>,
<span class="pair"><span class="key">"homepage"</span>: <span class="value">"http://jolicode.com"</span></span>,
<span class="pair"><span class="key">"time"</span>: <span class="value">"2012-12-21"</span></span>,
<span class="pair"><span class="key">"license"</span>: <span class="value">"MIT"</span></span>,
<span class="pair"><span class="key">"authors"</span></span>: [
{
<span class="pair"><span class="key" data-prefix="authors-">"name"</span>: <span class="value">"Xavier Lacot"</span></span>,
<span class="pair"><span class="key" data-prefix="authors-">"email"</span>: <span class="value">"[email protected]"</span></span>,
<span class="pair"><span class="key" data-prefix="authors-">"homepage"</span>: <span class="value">"http://www.lacot.org"</span></span>,
<span class="pair"><span class="key" data-prefix="authors-">"role"</span>: <span class="value">"Developer"</span></span>
},
{
<span class="pair"><span class="key" data-prefix="authors-">"name"</span>: <span class="value">"Benjamin Clay"</span></span>,
<span class="pair"><span class="key" data-prefix="authors-">"email"</span>: <span class="value">"[email protected]"</span></span>,
<span class="pair"><span class="key" data-prefix="authors-">"homepage"</span>: <span class="value">"http://ternel.net"</span></span>,
<span class="pair"><span class="key" data-prefix="authors-">"role"</span>: <span class="value">"Developer"</span></span>
}
],
<span class="pair"><span class="key">"support"</span></span>: {
<span class="pair"><span class="key" data-prefix="support-">"email"</span>: <span class="value">"[email protected]"</span></span>,
<span class="pair"><span class="key" data-prefix="support-">"issues"</span>: <span class="value">"https://github.com/jolicode/GouvCamp-mobile/issues"</span></span>,
<span class="pair"><span class="key" data-prefix="support-">"forum"</span>: <span class="value">"http://www.my-forum.com/"</span></span>,
<span class="pair"><span class="key" data-prefix="support-">"wiki"</span>: <span class="value">"http://www.my-wiki.com/"</span></span>,
<span class="pair"><span class="key" data-prefix="support-">"irc"</span>: <span class="value">"irc://irc.freenode.org/composer"</span></span>,
<span class="pair"><span class="key" data-prefix="support-">"source"</span>: <span class="value">"https://github.com/jolicode/GouvCamp-mobile"</span></span>
},
<span class="pair"><span class="key">"require"</span>: <span class="value">{
"monolog/monolog": "1.0.*",
"joli/ternel": "@dev",
"acme/foo": "dev-master#2eb0c0978d290a1c45346a1955188929cb4e5db7"
}</span></span>,
<span class="pair"><span class="key">"require-dev"</span>: <span class="value">{
"debug/dev-only": "1.0.*"
}</span></span>,
<span class="pair"><span class="key">"conflict"</span>: <span class="value">{
"another-vendor/conflict": "1.0.*"
}</span></span>,
<span class="pair"><span class="key">"replace"</span>: <span class="value">{
"debug/dev-only": "1.0.*"
}</span></span>,
<span class="pair"><span class="key">"provide"</span>: <span class="value">{
"debug/dev-only": "1.0.*"
}</span></span>,
<span class="pair"><span class="key">"suggest"</span>: <span class="value">{
"monolog/monolog": "Allows more advanced logging of the application flow"
}</span></span>,
<span class="pair"><span class="key">"autoload"</span>: <span class="value">{
"psr-4": {
"Monolog\\": "src/",
"Vendor\\Namespace\\": ""
},
"psr-0": {
"Monolog": "src/",
"Vendor\\Namespace": ["src/", "lib/"],
"Pear_Style": "src/",
"": "src/"
},
"classmap": ["src/", "lib/", "Something.php"],
"files": ["src/MyLibrary/functions.php"]
}</span></span>,
<span class="pair"><span class="key">"autoload-dev"</span>: <span class="value">{
"psr-0": {
"MyPackage\\Tests": "test/"
}
}</span></span>,
<span class="pair"><span class="key">"target-dir"</span>: <span class="value">"Symfony/Component/Yaml"</span></span>,
<span class="pair"><span class="key">"minimum-stability"</span>: <span class="value">"stable"</span></span>,
<span class="pair"><span class="key">"repositories"</span></span>: [
{
<span class="pair"><span class="key" data-prefix="repositories-composer-">"type"</span>: <span class="value">"composer",
"url": "http://packages.example.com"</span></span>
},
{
<span class="pair"><span class="key" data-prefix="repositories-vcs-">"type"</span>: <span class="value">"vcs",
"url": "https://github.com/Seldaek/monolog"</span></span>
},
{
<span class="pair"><span class="key" data-prefix="repositories-pear-">"type"</span>: <span class="value">"pear",
"url": "http://pear2.php.net"</span></span>
},
{
<span class="pair"><span class="key" data-prefix="repositories-package-">"type"</span>: <span class="value">"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/"
}
}</span></span>
}
],
<span class="pair"><span class="key">"config"</span></span>: {
<span class="pair"><span class="key" data-prefix="config-">"process-timeout"</span>: 300,</span>
<span class="pair"><span class="key" data-prefix="config-">"use-include-path"</span>: false,</span>
<span class="pair"><span class="key" data-prefix="config-">"preferred-install"</span>: "auto",</span>
<span class="pair"><span class="key" data-prefix="config-">"github-protocols"</span>: ["git", "https", "http"],</span>
<span class="pair"><span class="key" data-prefix="config-">"github-oauth"</span>: {"github.com": "oauthtoken"},</span>
<span class="pair"><span class="key" data-prefix="config-">"github-domains"</span>: ["github.com"],</span>
<span class="pair"><span class="key" data-prefix="config-">"http-basic"</span>: {"toto.org": {"username": "foo", "password": "bar"},</span>
<span class="pair"><span class="key" data-prefix="config-">"store-auths"</span>: "prompt",</span>
<span class="pair"><span class="key" data-prefix="config-">"autoloader-suffix"</span>: "pony",</span>
<span class="pair"><span class="key" data-prefix="config-">"optimize-autoloader"</span>: true,</span>
<span class="pair"><span class="key" data-prefix="config-">"prepend-autoloader"</span>: true,</span>
<span class="pair"><span class="key" data-prefix="config-">"vendor-dir"</span>: "vendor",</span>
<span class="pair"><span class="key" data-prefix="config-">"bin-dir"</span>: "bin",</span>
<span class="pair"><span class="key" data-prefix="config-">"cache-dir"</span>: "$home/cache",</span>
<span class="pair"><span class="key" data-prefix="config-">"cache-files-dir"</span>: "$cache-dir/files",</span>
<span class="pair"><span class="key" data-prefix="config-">"cache-repo-dir"</span>: "$cache-dir/repo",</span>
<span class="pair"><span class="key" data-prefix="config-">"cache-vcs-dir"</span>: "$cache-dir/vcs",</span>
<span class="pair"><span class="key" data-prefix="config-">"cache-files-ttl"</span>: 15552000,</span>
<span class="pair"><span class="key" data-prefix="config-">"cache-files-maxsize"</span>: "300MiB",</span>
<span class="pair"><span class="key" data-prefix="config-">"notify-on-install"</span>: true,</span>
<span class="pair"><span class="key" data-prefix="config-">"discard-changes"</span>: false</span>
},
<span class="pair"><span class="key">"archive"</span>: <span class="value">{
"exclude": ["/foo/bar", "baz", "/*.test", "!/foo/bar/baz"]
},</span></span>
<span class="pair"><span class="key">"prefer-stable"</span>: <span class="value">true,</span></span>
<span class="pair"><span class="key">"scripts"</span>: <span class="value">{
"pre-install-cmd": "MyVendor\\MyClass::doSomething",
"post-install-cmd": [
"MyVendor\\MyClass::warmCache",
"phpunit -c app/"
],
"pre-update-cmd": "MyVendor\\MyClass::doSomething",
"post-update-cmd": "MyVendor\\MyClass::doSomething",
"pre-status-cmd": "MyVendor\\MyClass::doSomething",
"post-status-cmd": "MyVendor\\MyClass::doSomething",
"pre-package-install": "MyVendor\\MyClass::doSomething",
"post-package-install": [
"MyVendor\\MyClass::postPackageInstall"
],
"pre-package-update": "MyVendor\\MyClass::doSomething",
"post-package-update": "MyVendor\\MyClass::doSomething",
"pre-package-uninstall": "MyVendor\\MyClass::doSomething",
"post-package-uninstall": "MyVendor\\MyClass::doSomething",
"pre-autoload-dump": "MyVendor\\MyClass::doSomething",
"post-autoload-dump": "MyVendor\\MyClass::doSomething",
"post-root-package-install": "MyVendor\\MyClass::doSomething",
"post-create-project-cmd": "MyVendor\\MyClass::doSomething",
"pre-archive-cmd": "MyVendor\\MyClass::doSomething",
"post-archive-cmd": "MyVendor\\MyClass::doSomething",
}</span></span>,
<span class="pair"><span class="key">"extra"</span>: <span class="value">{ "key": "value" }</span></span>,
<span class="pair"><span class="key">"bin"</span>: <span class="value">["./bin/toto"]</span></span>
}</pre>
</div>
<div class="span4">
<div class="doc">
<p class="title"></p>
<p class="type"></p>
<p class="required"></p>
<p class="hint"></p>
</div>
</div>
</div>
</div>
<footer>
<p>Brought to you by <a href="http://jolicode.com">JoliCode</a> - Inspired
by <a href="http://package.json.nodejitsu.com/">Nodejitsu</a> - Found a typo? Something is wrong
in this documentation? Just <a href="https://github.com/jolicode/composer-cheatsheet/blob/gh-pages/index.html">fork and edit it</a>!</p>
</footer>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-29696798-5', 'jolicode.com');
ga('send', 'pageview');
</script>
</body>
</html>