Cs-Cart and Symfony console

For sometime now i had the idea to use symfony console component in some of my cs-cart addons to run crontab or other long tasks without creating for each one of them a script in shop’s root folder. First issue was to add console and finder in cs-cart. There is a composer.json in app/lib and tested to require some components and it worked smoothly. Then needed to auto register any commands in any enabled addon. This requires command classes to be namespaced, something that also works in 4.x cs-carts. In any addon folder create a folder like Slx\Command and add there a class with namespace Slx\Command and thats it! Autoloading works! In some of the first versions of 4.x autoloading does not work so good and have to add Tygh fist, that means Tygh/Slx/Command, in order to make autoloading include that folder also.


Leave a Reply

Your email address will not be published. Required fields are marked *