Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't commit composer.lock for a library! #308

Closed

Conversation

danhunsaker
Copy link
Contributor

It's generally a bad idea to lock external requirements down to a specific revision in a project that will, itself, be required by others. Remove composer.lock, prevent it from being re-added, and allow Composer to select an appropriate version given other external libraries pulled in by the end developer.

Signed-off-by: Dan Hunsaker <danhunsaker@gmail.com>
@chrisboulton
Copy link
Owner

I don't think I actually buy into this in general, and it's a conversation I've had with other libraries - my understanding is that in consumption of a library in some application, only composer.json is used for determining and resolving dependencies, so consumers should be fine. The lock file is ignored.

What composer.lock is useful for is for me actually developing php-resque, to ensure dependencies between local development & test (w/ Travis) aren't changing.

Are my assumptions are wrong.

@rajibahmed
Copy link
Contributor

I agree with you Chris, in Ruby world Gemfile.lock is important, npm don't have locking thats bad, composer locking I would say should be used for integration tests and deployment of main application code.

@schmunk42
Copy link

@chrisboulton I'd also 100% agree to your statement.

@danhunsaker
Copy link
Contributor Author

danhunsaker commented Mar 25, 2017

Fair points, though I'd argue that locking the versions you test against will only ensure the locked versions work properly, not the versions users would actually encounter in their own projects. Instead, I'd personally recommend testing against the most recent versions, as well as the oldest, pulled in by your composer dependency declarations, and then tuning those if necessary.

@schmunk42
Copy link

testing against the most recent versions, as well as the oldest,

... as well as all combinations in between, eg. because of constraints of your PHP version. That's not really feasible.

Locking a lib is absolutely fine for development, otherwise everything is "flying target".

@danhunsaker danhunsaker closed this Dec 2, 2018
@danhunsaker danhunsaker deleted the bugfix/remove-lockfile branch December 2, 2018 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants