R
R
RJs452015-02-23 13:00:29
Laravel
RJs45, 2015-02-23 13:00:29

What if you need to change a third party library in Laravel?

I don’t even know if I correctly formulated the question, in fact, the problem is: We use the digitick / sepa-xml
package in the Laraval project to generate SEPA XML. The problem is that when generating it, it includes information in the header that is redundant in some banks and the generated XML does not pass validation.

function __construct($painFormat)
    {
        $this->painFormat = $painFormat;
        $this->doc = new \DOMDocument('1.0', 'UTF-8');
        $this->doc->formatOutput = true;
        $this->root = $this->doc->createElement('Document');
        $this->root->setAttribute('xmlns', sprintf("urn:iso:std:iso:20022:tech:xsd:%s", $painFormat));
        $this->root->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance");
        $this->root->setAttribute('xsi:schemaLocation', "urn:iso:std:iso:20022:tech:xsd:$painFormat $painFormat.xsd");
        $this->doc->appendChild($this->root);
    }

You need everything exactly the same, only without
$this->root->setAttribute('xsi:schemaLocation', "urn:iso:std:iso:20022:tech:xsd:$painFormat $painFormat.xsd");

What is the right thing to do in such cases? How to override the behavior of a third party package? Editing in /vendor is very, very bad.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
windoctor, 2015-02-23
@windoctor

Fork?

M
Mikhail Pomytkin, 2015-02-24
@DanteXXI

bang an unnecessary header after the formation, but before the response is sent. If it doesn't work, donate the library)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question