I had created a controller in custom module using drupal 8.

 public function subscribe(Request $request) {

        $url='https://username:[email protected]/v1/subscriptions';


I am using git for development. This url is actually for Razorpay subscriptions. These url might get changed according to the mode in razorpay. So the url subscriptions in razorpay for test mode and live mode is different. I have to change url every time in this custom module while managing git. Can I define this"$url" somewhere in backend in db or settings.php?

1 Answer 1


In your settings file add

$settings['razorpayUrl'] = 'https://example.com';

Then in your module

use Drupal\Core\Site\Settings;
$url = Settings::get('razorpayUrl');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.