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.
# Copy this file...
/vendor/doublesecretagency/craft-notifier/src/config.php
# To here... (and rename it)
/config/notifier.php
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.
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'),
// Adjust the default Twig sandbox configuration
'twigSandbox' => []
];
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:
# Testing phone number in local environment
TEST_TO_PHONE_NUMBER="888-555-4444"
twigSandbox
array - Defaults to []
(changes none of the defaults).
Optionally adjust the default Twig sandbox configuration.
Configuration Instructions
For more details on how to use this powerful feature, please consult the Twig Sandbox page.