Yii2 codeception connector does this: https://github.com/Codeception/Codeception/blob/master/src/Codeception/Util/Connector/Yii2.php#L38