Skip to content

Set config on run time instead of config file #12

Open
@lucafilosofi

Description

@lucafilosofi

Hi, first of all, thank you for your work!

i guess it would be very nice to have the ability to set config as arguments to the WoocommerceApi Class, bypassing the static config file, this would help in case of batch calling on multiple endpoints, i know you can use the builtin config([]) function but in my test it does not work if i run a loop through php artisan command

example code:

foreach(['A', 'B', 'C'] as $endpoint){
   config(['woocommerce.store_url' => '...']);
   config(['woocommerce.consumer_key' => '...']);
   config(['woocommerce.consumer_secret' => '...']);

  $orders = WooCommerce::all('orders', ...);
  // $orders will output the same results for every endpoint, 
  // because the config changes only for the first endpoint
}

hope this make sense! ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions