With reference to my own question, I have found that we can change density and number of lines and dots in native magento 2 captcha in /vendor/magento/zendframework1/library/Zend/Captcha/Image.php.

Now my question is that how can we override above file class using custom module, because we don't want to make changes directly in core magento files.

Any help would be appreciated.



It is not so complicated. First in composer.json file add this line in psr-0 node

"Zend_Captcha": "app/code/"

so it will look like that

"psr-0": {
   "": "app/code/",
   "Zend_Captcha": "app/code/"

Then create directory app/code/Zend/Captcha/ and place there your file Image.php that you want to override.

After that just run composer update.

  • Ok, let me try. – Mohit Kumar Arora Aug 11 '16 at 8:26
  • If my module does not have composer.json, then is it possible? – Mohit Kumar Arora Aug 11 '16 at 8:59
  • 1
    After using composer update, it worked. If I want to use it as personal extension, how can I include my composer.json in it? – Mohit Kumar Arora Aug 11 '16 at 11:37
  • 1
    How to override vendor/magento/zendframework1/library/Zend/Locale/Data/pa.xml, Could you please let me know? – Rakesh Jesadiya Nov 30 '16 at 11:32
  • 1
    Instead of changing in Magento default composer.json can we also overwrite that? – Ankit Shah Jan 20 '17 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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