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

Add composer support #7

Merged
merged 1 commit into from
Jul 27, 2012
Merged

Conversation

hellogerard
Copy link
Contributor

Composer is a dependency manager for PHP similar to bundler for Ruby and others. It makes library installation and management easier, and more importantly encourages code re-use within the PHP world, something PHP currently does VERY poorly.

So, in theory, all one needs to do to add composer support is to add composer.json. I started out this way, but had to make severe changes because of the embedded SwiftMailer dependency. So there are several changes for this simple task, but I think this is a much better way to do it. All tests still pass.

  • Removed embedded SwiftMailer library
  • Set up composer to install SwiftMailer as a dependency (same minor version)
  • Modify class loading to use composer autoloader in lib and in tests
  • Update README with new installation, usage

@theycallmeswift
Copy link
Contributor

How do we deal with users who aren't using Composer? Instruct them on manually adding dependencies?

What other libraries use it too? Any major ones?

@hellogerard
Copy link
Contributor Author

Hi. That thought crossed my mind. The short answer is: everybody should be using Composer :)

Composer is gaining rapid support. For technical background in favor of this type of dep. management, see this blog: http://philsturgeon.co.uk/blog/2012/03/packages-the-way-forward-for-php

Composer started with the Symfony folks, so Symfony of course uses it. Zend Framework 2 will use it. SwiftMailer itself uses it. The Facebook PHP-SDK uses it. There are hundreds of other packages up on http://packagist.org, the main repo.

@theycallmeswift
Copy link
Contributor

Yeah, but the Facebook SDK and SwiftMailer don't have dependencies. We don't want to give the message "you have to use composer to use our library" (since that is in fact not true).

My gut says: we should include the composer.json, but leave swiftmailer as a part of the repo. Maybe we could move it to a submodule though since it should work with the latest version at all times

@hellogerard
Copy link
Contributor Author

Well, composer is a dependency manager, so having SwiftMailer as a dependency would be even more reason to go with it.

But in any case, sounds good. I'll revert the original commits except for composer.json, and leave SwiftMailer in the repo. I just need to test that autoloading works. I'll try to get to this tomorrow.

@hellogerard
Copy link
Contributor Author

Ok, I rewrote the pull request to add a simple composer.json.

@theycallmeswift theycallmeswift merged commit c483570 into sendgrid:master Jul 27, 2012
@theycallmeswift
Copy link
Contributor

Sorry it took me so long to get to this. Merged.

Thanks for helping out!

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.

2 participants