Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dabnad's avatar

Get a config field in Controller php file

Hey, I was wondering how can I grab a config variable (which I can find in view pages using Config::get('filename.Variable')) in a model controller (which is a normal php) file.

Thanks in advance everyone, Have a great weekend and a happy new year!

0 likes
2 replies
wilburpowery's avatar
Level 23

Why not use the config global helper function?

$stripeToken = config('services.stripe.token');

1 like
dabnad's avatar

Thanks wilburpowery, I didn't know there's a function for that.

1 like

Please or to participate in this conversation.