Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Is There A Best Practice For Using Composer Packages Under The Addon? Rate Topic   - - - - -

 

Posted 14 March 2019 - 02:59 AM #1

I am developing some addons that require extra composer packages.
I know cscart already have composer packages, but it is a part of core files, so I don't want to mess with it.
 
 
What I did is init composer in the addon folder and required autoload.php file in func.php. This seems work but I am not sure this is the best practice.
 
 
Any suggestions?
Thanks.


 

Posted 14 March 2019 - 03:11 AM #2

Or register only required classes into container using service provider without including autoload.php?



 

Posted 14 March 2019 - 03:22 AM #3

Nope. not including autoload.php won't resolve namespace.



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 705 posts

Posted 14 March 2019 - 08:23 AM #4

Hello 
I always attach the necessary libraries to the package in the lib directory.
It seems that it would be best in addon.xml to add a function called during the installation which will download the necessary libraries.
 
Best regards
Robert.

Team of SoftSolid
cs-cart.pl