driesvints / vat-calculator

Handle all the hard stuff related to EU MOSS tax/vat regulations, the way it should be.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Config in stand alone PHP app

maxoosterveen opened this issue · comments

Hello!

We're creating a stand alone PHP application that has the need to calculate VAT with some overwritten config. I was wondering how we would go about using a config file in a application not using Laravel.

Thanks in advance!

Hey @maxoosterveen,

Install notes can be found here: https://github.com/driesvints/vat-calculator#standalone. Besides that all of the Laravel facade examples can be used in the same way on a standalone PHP app but using $vatCalculator-> instead.

Going to close this now but feel free to ask more questions if you have them.

Hi. I have the same question. The standalone install notes explain how to use the class (they're very good/clear by the way!) however they don't explain how to create a standalone config file. Am I (and @maxoosterveen) missing something?

I initially thought the config was just an array, but then realised it has it's own config container created by the VatCalculatorServiceProvider but am unable to trace back which class I need to use to create the container myself in a standalone situation.

Thanks!

Ah I see. Hmm, I'm not sure if I'm going to put time into editing the readme since I'm probably going to overhaul all of that in v3. But that might be a while. Sorry about that. If anyone can figure out how to do that in a standalone PHP app feel free to PR a note to the docs and I'll add it in 👍

The way I did this was to extend the Vat-Calculator class, since the variables are declared protected, not private. So I could access them directly and add custom functionality. Cool beans! :) Took me an hour to realise that I could do this 5-minute fix haha.