$consumerkey = "xxx";
$consumersecret = "xxx";
$accesstoken = "xxx";
$accesstokensecret = "xxx";
try {
$connection = new \TwitterOAuth($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$connection->post('statuses/update', ['status' => 'Test message']);
} catch (\Exception $e) {}