Closed robertnicjoo closed 6 years ago
Yes, just put env('RAJAONGKIR_API_KEY')
when you initialize class Rajaongkir\Domestic
(i assumed you has set env RAJAONGKIR_API_KEY=your-key
) and you can define your account type with constant Rajaongkir\Domestic::ACCOUNT_STARTER
, Rajaongkir\Domestic::ACCOUNT_BASIC
, or Rajaongkir\Domestic::ACCOUNT_PRO
(default is starter)
I hope this can help you @robertnicjoo
thanks for respond @ncaneldiee
RAJAONGKIR_API_KEY=your-key
goes to my env file
and for my account type should i do like so: (please correct me if i'm wrong)
public function __construct() {
$rajaongkir = new Rajaongkir\Domestic(YOUR_API_KEY, Rajaongkir\Domestic::ACCOUNT_PRO);
}
sort of strange! isn't it?
I got your point @robertnicjoo, you want to simply using RAJAONGKIR_API_KEY
and RAJAONGKIR_API_KEY
in your .env file, right ? Please see this laravel package config for example, i use this package for laravel project one year ago, and laravel using .env file
@ncaneldiee yes that's what i'm looking for, but there is no artisan command in documentation to publish config file and there is no config file in vendor either! should i make this config file manually?
Try artisan vendor:publish
, see this. FYI, for laravel you need load other package https://github.com/ncaneldiee/rajaongkir-laravel
@ncaneldiee ok there was a mistake by me sorry about that, i used this package instead of laravel version which is this currently i try to install that package, while is processing one question?
don't you think it suppose to have ::class
after provider
and aliases
?
your code:
'Ncaneldiee\Rajaongkir\Laravel\RajaongkirServiceProvider',
'Rajaongkir\Domestic' => 'Ncaneldiee\Rajaongkir\Laravel\RajaongkirDomesticFacade',
'Rajaongkir\International' => 'Ncaneldiee\Rajaongkir\Laravel\RajaongkirInternationalFacade',
my idea:
Ncaneldiee\Rajaongkir\Laravel\RajaongkirServiceProvider::class,
'Rajaongkir\Domestic' => Ncaneldiee\Rajaongkir\Laravel\RajaongkirDomesticFacade::class,
'Rajaongkir\International' => Ncaneldiee\Rajaongkir\Laravel\RajaongkirInternationalFacade::class,
what do you think?
I think both will work, but your PR is very welcome expecially with auto discovery package feature
hi, does this package support env codes?
where should I define my accound
api key
andtype
?