Skip to content

Conversation

@MissAllSunday
Copy link
Contributor

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

  • Composer is solely used by SMF, that is, no access to mod authors. Mod authors can still ship their own vendor folder if they provide their respective configuration for it
  • Modifications to Simplemachines/build-tools will have to be made to further remove hardcoded instances of third party libs, happy to do those changes myself if required.
  • SMF release process will need to change to accommodate composer commands.

Copy link
Contributor

@live627 live627 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested working. Normal forum operations still work as expected.

@live627
Copy link
Contributor

live627 commented Dec 20, 2024

@MissAllSunday this is still marked as draft. You plan on more changes here?

@MissAllSunday
Copy link
Contributor Author

@MissAllSunday this is still marked as draft. You plan on more changes here?

Nope, will mark it as ready and resolve the conflicts

@MissAllSunday MissAllSunday marked this pull request as ready for review December 24, 2024 17:06
@MissAllSunday MissAllSunday changed the title POC: manage third party libs via composer [3.0] Manage third party libs via composer Dec 24, 2024
@live627
Copy link
Contributor

live627 commented Dec 25, 2024

Upon further testing, integrate_autoload doesn't work because it is called before settings are loaded. My fix live627@cfdfe79 should I submit this as another PR?

@MissAllSunday
Copy link
Contributor Author

Not really sure, it has to do with this PR so it makes sense to include it here but it could also be a separate PR specially if this one doesn't get merged, up to you. Best of options would be include it here and also send it as a separate PR I suppose.

@MissAllSunday
Copy link
Contributor Author

I did a rebase from release-3.0 will take a look at this again

@Oldiesmann
Copy link
Contributor

I've been waiting for this PR for 5 years. Please merge it soon.

3.0 is still in alpha so it will still be a while before it's ready for use on a production forum

@MissAllSunday
Copy link
Contributor Author

I've been waiting for this PR for 5 years. Please merge it soon.

3.0 is still in alpha so it will still be a while before it's ready for use on a production forum

Probably just a spammer account, I wouldn't pay too much attention to it

@sbulen
Copy link
Contributor

sbulen commented Apr 1, 2025

Abuse reported.

Wildly inappropriate. First time I've seen anything like that on GH.

Copy link
Member

@Sesquipedalian Sesquipedalian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to ./Sources/Autoloader.php will pollute the global namespace with several variables. Could you please wrap all of that code in a closure in order to keep it contained? The code in ./index.php for loading ./Settings.php would be a good model for this.

Moreover, with these changes, how does autoloading of our own classes work? Perhaps I am missing something, but it looks to me that by removing the call to spl_autoload_register() from ./Sources/Autoloader.php, this PR removes our ability to autoload our own classes.

@jdarwood007
Copy link
Member

@MissAllSunday, can you also ensure that the readme is updated with relevant information for those looking to start using the development version? Nothing fancy, I would add a bullet to the how to contribute section.

@MissAllSunday
Copy link
Contributor Author

@Sesquipedalian @jdarwood007

How about this approach? essentially removing the Autoloader file and the need to call Integration classes and instead, add the autoloader logic inside the already established closure which already checks and loads all what we need for using composer's autoloader. Since autoloading happens quite early and its a special case, I don't think we need to fully load Integration class to handle it, I used the same approach we already used when loading integrate_pre_include hooks on Config.

Regarding autoloading own classes, the SMF namespace was moved to composer's configuration, meaning all classes that has that namespace will still be autoloaded just like it was before this change. If there is a class that doesn't use the SMF namespace or lives outside its scope then it will have to be changed or its unique namespace to be added to composer's autoload setting

@MissAllSunday
Copy link
Contributor Author

rebased against latest release-3.0

@jdarwood007
Copy link
Member

#8801 adds another library. So, figuring this out is becoming more important. Hopefully, we can get it tagged to a milestone.

@live627
Copy link
Contributor

live627 commented Jul 26, 2025 via email

@MissAllSunday
Copy link
Contributor Author

Figuring this out as in there is still something to be resolved on this PR?

@live627
Copy link
Contributor

live627 commented Jul 28, 2025

As in, getting this assigned to a milestone; sorry for not being clear there.

@MissAllSunday
Copy link
Contributor Author

This branch and release-3.0 has diverged quite significantly so a rebase was causing a lot of problems, better start fresh so a new PR was submitted at: #9015

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.

6 participants