question
avatar AmyStephen
AmyStephen
25 Apr 2013

@mbabker -

Thought I should open a new issue for the archive discussion.

Looks like Composer recently added (last commit a month ago) composer/composer#1567 a new archive feature to create zips, exclude files, etc., using Composer. composer/composer#1567

I need to look into this further. The Composer Book - 5.2.23 talks a bit about the archive feature which is used with the script http://getcomposer.org/book.pdf

This next week is busy - after next Tuesday my time frees up. Need to learn more about this, too, so, I'll share what I learn. Thanks!

avatar AmyStephen AmyStephen - open - 25 Apr 2013
avatar AmyStephen AmyStephen - open - 25 Apr 2013
avatar b2z b2z - close - 3 Nov 2013
avatar mbabker mbabker - reopen - 3 Nov 2013
avatar b2z
b2z - comment - 23 Jan 2014

@AmyStephen any update on it?

avatar AmyStephen
AmyStephen - comment - 23 Jan 2014

Thanks for reminding me -- I just now played with it and it's pretty slick.

Assuming you have composer.phar installed - go to the root of your local repository and type:

$ composer.phar archive --format=zip

The command above creates a zip using all of the requirements defined in your composer.json

There are ways to place the archive file into a specified folder (like your build folder) and to specify a package and or specific version. (documented in this next section from the book).

From the guide:

4.20 archive    
This command is used to generate a zip/tar archive for a given package in a given version.
It can also be used to archive your entire project without excluded/ignored files.

$php composer.phar archive vendor/package2.0.21 -- format=zip

4.20.1 Options
–format (-f): Format of the resulting archive: tar or zip (default: “tar”)
–dir: Write the archive to this directory (default: “.”)

Also, you can exclude certain files (folders and files) by specifying such in your composer.json file using the archive options documented 5.5.23

Works slick!

Let me know if more info might be helpful!

avatar b2z
b2z - comment - 23 Jan 2014

Thanks for the info Amy!
You may blame the J!Tracker Application for transmitting this comment.

avatar b2z b2z - close - 1 Sep 2014

Add a Comment

Login with GitHub to post a comment