Use this snippet to connect to XenForo 2.
Read the DevLog for more details.
PHP:
/** @var $fileDir */
$fileDir = '/Path/To/community';
require($fileDir . '/src/XF.php');
XF::start($fileDir);
$app = XF::setupApp('XF\Pub\App');
$app->start();
Read the DevLog for more details.