mpesa-php-sdk icon indicating copy to clipboard operation
mpesa-php-sdk copied to clipboard

load environment configs from database

Open Nickbahson opened this issue 6 years ago • 8 comments

Would be great if there was a way to set the environment configs on every request, like load the required values from a database before calling e.g. like //Example `$mpesa->setConfigs( [ MPESA_CONSUMER_KEY= [consumer key] MPESA_CONSUMER_SECRET=[consumer secret] MPESA_ENV=[live or sandbox] ]; );

$mpesa->STKPushSimulation();`

Nickbahson avatar Jan 23 '19 10:01 Nickbahson

I second you on this. They should just do away with the .env file. I have to edit their repository before i use it. Please work on this

Davisonpro avatar Jan 28 '19 12:01 Davisonpro

I second you on this. They should just do away with the .env file. I have to edit their repository before i use it. Please work on this

why do you have to edit the repo? just create a .env file and paste your mpesa configs there.

ngarawakimani avatar Feb 09 '19 11:02 ngarawakimani

I agree with that. The problem comes when you have to explain this to a client who wants things done and he/she understands nothing about accessing and editing files on a server. It would be better if I just add a section to edit the configuration on their website and for Mpesa SDK to pull the configuration from the database. And using the env method will not support that

It's a design practice for sdks.

Davisonpro avatar Feb 09 '19 11:02 Davisonpro

so you guys want to store configs in a database?

ngarawakimani avatar Feb 09 '19 17:02 ngarawakimani

Not necessarily. I think it would be great if you you went with @Nickbahson option

Davisonpro avatar Feb 09 '19 20:02 Davisonpro

On it guys. I Will add this option

mossey avatar Feb 21 '19 10:02 mossey

the best way is to add a config that can override the default env

josiahke avatar May 20 '19 07:05 josiahke

@josiahke , you don't have to override the default .env file unless you have to.

Nickbahson avatar Nov 06 '19 11:11 Nickbahson