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

use composer to manage dependencies #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thkoch2001
Copy link

It's not common practice to also commit the vendor folder to git. But
this way it's easier for people to just checkout the project and run it.

The composer.json file is very verbose in this case because none of the
dependencies are composer projects. Thus the github urls needed to be
added explicitly here.

The next step would be to package the application as a phar file for end
users and to remove the vendor folder from git.

For building phars see:
http://box-project.github.io/box2
https://moquet.net/blog/distributing-php-cli/
http://yet.another.linux-nerd.com/blog/create-a-simple-phar-command-line-project-based-on-symfony-components

It's not common practice to also commit the vendor folder to git. But
this way it's easier for people to just checkout the project and run it.

The composer.json file is very verbose in this case because none of the
dependencies are composer projects. Thus the github urls needed to be
added explicitly here.

The next step would be to package the application as a phar file for end
users and to remove the vendor folder from git.

For building phars see:
http://box-project.github.io/box2
https://moquet.net/blog/distributing-php-cli/
http://yet.another.linux-nerd.com/blog/create-a-simple-phar-command-line-project-based-on-symfony-components
@jens-maus
Copy link
Owner

First of all thank you for this pull request. After quickly having looked over it and trying to understand what it does and which implications this might have I have to say that I am not completely convinced if all the change to composer and phar might really be a good thing for such a small project like carddav2fb. In the end this composer environment just complicates the build and release environment of carddav2fb and for end users this also doesn't bring any real benefit. While I understand that for large scale projects compose might perfectly make sense, for carddav2fb (which is and will only be a very basic command-line script) it looks like this is just overkill.

So why do you feel this composer/phar move might do carddav2fb any good? Apart from "might be cool" I cannot see any real practical benefit. Also maintaining the third-party sources using the git subtree functionality provides enough flexibility in diffing/merging changes between the individual repositories.

@thkoch2001
Copy link
Author

Why composer (for this particular project):

  • It's a canonical way of describing where your dependencies come from. I had to google and manually compare to find the three github repos and the correct forks.
  • It enables you to do use more dependencies without this becoming unmanagable. I'd for example use symfony console as a next step to add commandline options. Symfony console might have transitive dependencies...
  • You can declare development dependencies (phpunit) separately from runtime dependencies.
  • I'm an experienced git user since 2008 but I don't know how to use git subtree without looking it up. Running composer update to update your dependencies is common knowledge now for many PHP developers.
  • Composer automatically generates an autoload.php file so that you don't need to use individual require statements for every Class.
  • You can also declare dependencies on the minimum PHP version and on PHP extensions in your composer.json. So composer warns you if you missed to install a PHP extension if you missed to read the README and check your phpinfo.

There are many more reasons to use composer which apply only for larger projects. But it's really not so complicate.

You're right that this is a small hackish script at the moment and that's a pity. I needed to fix it in two places to make it work with mailbox.org (OpenXChange). The transfer is also incomplete. So to become reliable and more easily usable I believe the script needs to grow a bit and be cleaned up.

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

2 participants