First to Site
Release 3.4

MYOB Production Configuration

Externalized hardcoded MYOB credentials and endpoints into environment variables in 3.4.2

Overview

v3.4.2 focused on a single urgent fix: removing hardcoded MYOB sandbox credentials and URLs from the codebase and replacing them with environment-driven configuration.

What Was Hardcoded

Six full MYOB endpoint URLs pointing to https://sbx-firsttosite.myobadvanced.com/entity/... were class constants in MyobClient.php. Credentials were hardcoded in getCredentials(): username, password, and company name - all pointing at the sandbox instance.

What Was Externalized

The MyobClient constructor now accepts 7 injected parameters via services.yaml from environment variables:

VariablePurpose
MYOB_BASE_URLBase MYOB instance URL
MYOB_ENTITY_PATHEntity API path prefix
MYOB_NAMEAPI username
MYOB_PASSWORDAPI password
MYOB_TENANTTenant identifier
MYOB_COMPANYCompany name (omitted if tenant is set)
MYOB_BRANCHBranch identifier

The six hardcoded full-URL constants were replaced with relative path constants (e.g., AUTH_LOGIN_PATH = '/entity/auth/login'), combined with the injected base URL via new getter methods (getLoginEndpoint(), getInvoiceEndpoint(), etc.).

This was both a security fix (exposed password in source) and a prerequisite for switching from the sandbox to the production MYOB instance.

Files Touched

FileChange
Library/Myob/MyobClient.phpModified - bulk of changes
config/services.yamlModified - DI wiring for 7 env vars
Controller/Api/ProjectInvoiceController.phpModified - call-site update
Library/Myob/InvoiceProcessor.phpModified - call-site update

Changelog Reference

  • fix: externalize MYOB client production configuration (#660)