0

I downloaded mews/captcha package as a zip file and I want to add it to my laravel project. Does anyone know how I can do this and which folders/files I need to update for it to work? (I can't use composer require/composer update)

Thanks!

m.m
  • 41
  • 1
  • 5
  • If you can't use composer commands does that also mean you can't use the composer autoloader? Or can you use it but not update it? – apokryfos Aug 01 '22 at 12:12
  • I can't use composer autoloader either :\ – m.m Aug 01 '22 at 12:17
  • assuming that you have an autoload file (but can't use any composer commands to update it) then the above should answer your question. If you don't even have an autoload file and the composer autoloader then Laravel itself should not be working – apokryfos Aug 01 '22 at 12:26
  • What is the correct way to do it with composer autoloader? – m.m Aug 01 '22 at 12:35
  • Extract the contents of the zip in your vendor directory and run `composer dump-autoload` if you can use that command. If you can't use the command follow the instructions in [this answer](https://stackoverflow.com/a/59713178/487813) – apokryfos Aug 01 '22 at 12:40
  • _Note_ that this package _is_ available in composer: https://packagist.org/packages/mews/captcha – Justinas Aug 01 '22 at 12:42
  • Thank you! I will try it. Regarding the second solution, the answer refers to a specific library and I don't know how it should look with the library I need. Do you know which reference I should add? @apokryfos – m.m Aug 01 '22 at 12:43
  • The source composer.json of that package is [here](https://github.com/mewebstudio/captcha/blob/master/composer.json). You should try to match what is in there in the `autoload` section e.g. in your case you should add `'Mews\\Captcha\\' => array($vendorDir . '/mews/captcha/src'),` the 2nd parameter should match exactly where you extracted the library. However this one has in addition a `files` entry which I suggest you manually require where you need it (if you need it) – apokryfos Aug 01 '22 at 13:41

0 Answers0