Is there a way to run a function (to call an api) once after a module is installed? It could be during admin page load or in the install script. But i wish to run only once. Thanks

  • hey did you get any solution for this?
    – Asad Khan
    Aug 11, 2021 at 13:17

1 Answer 1


Suggest to use Install script because of InstallSchema code is run one time.

So, on your extension, you have to write InstallSchema.php which is located at app/code/{VendorName}/{ModuleName}/Setup..

See how to create install scheme Look this block:https://www.magestore.com/magento-2-tutorial/how-to-create-and-upgrade-database-in-magento-2/

  • thanks. But it does not work. I tried to do some action on the install function but it does not do anything.
    – subhas
    Aug 28, 2018 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.