t0berius
8 months ago
53
1
Tips

overwriting package code

Posted 8 months ago by t0berius

I'm using for example a captcha library inside my laravel based application, the captcha was included using composer.

Since some of the config is not included inside the .conf file of the package itself, I would need to edit some functions of the package code itself.

What's the best way to do so, since editing code inside the package (vendor) dir is a bad idea in general.

I'm using

https://github.com/igoshev/laravel-captcha/tree/2.1

And I would need to overwrite the render() function:

<?php

namespace Igoshev\Captcha\Captcha\Generator;

class GeneratorWaves extends AbstractGenerator implements GeneratorInterface
{
    public function render($str, $params){

    }
}

What's the most proven way to do so? And where to place the overwriting code?

Please sign in or create an account to participate in this conversation.