Skip to content

PHP Config File

Everything on the plugin's Settings page can also be managed via PHP in a config file. By setting these values in config/notifier.php, they take precedence over whatever may be set in the control panel.

To configure the sandbox, start by creating a config/notifier.php file. It might look something like this...

php
// config/notifier.php

return [

    // Twilio (only needed if using Twilio to send SMS messages)
    'twilioAccountSid'  => getenv('TWILIO_ACCOUNT_SID'),
    'twilioAuthToken'   => getenv('TWILIO_AUTH_TOKEN'),
    'twilioPhoneNumber' => getenv('TWILIO_PHONE_NUMBER'),

    // Phone number to use for SMS testing purposes
    'testToPhoneNumber' => getenv('TEST_TO_PHONE_NUMBER'),

];

Much like the db.php and general.php files, notifier.php is environmentally aware. You can also pass in environment values using the getenv PHP method.

Settings available via Control Panel

Twilio API credentials can also be managed on the Settings page (preferably using env values).

Learn more about managing your Twilio API credentials.

Settings available only via PHP file

testToPhoneNumber

string|null - Defaults to null.

Recipient phone number to intercept all outbound SMS messages. Similar to testToEmailAddress.

Set the testing phone number in your local .env file, then load it via the PHP config file:

dotenv
# Testing phone number in local environment
TEST_TO_PHONE_NUMBER="888-555-4444"

Deprecated Settings

twigSandbox [DEPRECATED]

This config setting is deprecated. For the new approach, see the Twig Sandbox documentation.