-
Notifications
You must be signed in to change notification settings - Fork 265
[3.0] Manage third party libraries via composer #9015
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
[3.0] Manage third party libraries via composer #9015
Conversation
|
@Sesquipedalian, I want to tag this into alpha 5, do you agree? |
I agree. I don't have capacity to review it myself right now (hard week this week), but I agree that it should be merged as soon as possible. |
|
I tested this on SMF 2.1, and there wasn't even a need to add |
|
yeah we don't strictly need vendordir, it was added mainly for keeping things uniformed and if in the future the vendor dir gets moved somewhere else, same principle as sourcedir or themedir. Will try to test this with mods that adds their own composer to see how they behave. |
| /** | ||
| * Path to where our dependencies are located. | ||
| */ | ||
| public static string $vendordir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also add a definition for this setting in Config::$settings_defs
|
Not a complete review by any stretch, but I did notice something that needs to be changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another problem: our .gitignore currently ignores the vendor directory, which means that ./vendor/autoload.php is not actually included in this PR. Since that file is clearly intended to handle the autoloading of SMF's own classes as well as third party libraries, it really needs to be included and tracked by our repository.
This also raises an additional question. Is it the intention of this PR for individual forums to use composer themselves in order to acquire the necessary third party libraries? If so, that would make composer a prerequisite for SMF, which I don't want to do. Our install and upgrade packages should contain all required third party libraries directly, with no additional requirement to have composer installed on the server. Of course, there is more than one way that we can do that, but it must be done one way or another.
|
Not a issue. Its our build process that will have to change. We will have to have it run the composer installer, but in regular mode not dev mode. If your packing SMF on your local dev env, you will need to |
|
Yeah, that should work. Still, we do need ./vendor/autoload.php to be committed to the repository, since it is going to be responsible for loading our own classes as well as the third party ones. |
|
We don't really need to include the autoload file or any other files within the vendor dir, we only need to commit the composer.json and perhaps, the composer.lock file, which are the ones that determinate the current state of SMF's third party requirements. This means that any developer looking to install SMF locally will have to have composer installed locally but then again, composer is, and has been from some time now, the de facto library manager for the entire PHP ecosystem so it shouldn't be an issue, for SMF's mod and theme developers who aren't used to composer, I can gladly post some guidelines on the wiki on how to install and use composer. This offers a lot of advantages since a mod or theme developer can easily reset their forums to a known state (the composer.lock file). Regular SMF users (admin forums) won't have to interact with composer since at the moment they download SMF, the package will have all the necessary third party libraries already included in the .zip file they download, meaning the installation process will remain the same for them. This is possible because at the moment the SMF package gets generated (a process internal for SMF) all the libraries will be installed at the exact state the composer file requires them, ensuring we will always have the latest versions available when generating a new SMF package. |
|
Should note that a discussion in the PHP group around making more official: https://externals.io/message/128796 |
This is a simple POC for allowing SMF to handle their internal third party libraries via composer.
Some key features to take into consideration for this POC