src/Keboola/Syrup/Controller/PublicController.php
public function indexAction()
    {
        $rootPath = str_replace('web/../', '', ROOT_PATH);

        $filepath = $rootPath . '/../../composer/installed.json';

        if (!file_exists($filepath)) {
            $filepath = $rootPath . '/vendor/composer/installed.json';
        }

        $installedJson = file_get_contents($filepath);

        $jsonDecoder = new JsonDecode(true);
        $installedArr = $jsonDecoder->decode($installedJson, JsonEncoder::FORMAT);

        $syrupComponents = array();
        foreach ($installedArr as $package) {
            $nameArr = explode("/", $package['name']);

            if ($nameArr[0] == 'syrup' || $nameArr[0] == 'keboola') {
                $syrupComponents[$package['name']] = $package['version'];
            }
        }

        return new JsonResponse(array(
            "host"          => gethostname(),
            "components"    => $syrupComponents,
            "documentation" => "http://documentation.keboola.com/syrup"
        ));
    }
public function indexAction()
    {
        $rootPath = str_replace('web/../', '', ROOT_PATH);

        $filepath = $rootPath . '/../../composer/installed.json';

        if (!file_exists($filepath)) {
            $filepath = $rootPath . '/vendor/composer/installed.json';
        }

        $installedJson = file_get_contents($filepath);

        $jsonDecoder = new JsonDecode(true);
        $installedArr = $jsonDecoder->decode($installedJson, JsonEncoder::FORMAT);

        $syrupComponents = array();
        foreach ($installedArr as $package) {
            $nameArr = explode("/", $package['name']);

            if ($nameArr[0] == 'syrup' || $nameArr[0] == 'keboola') {
                $syrupComponents[$package['name']] = $package['version'];
            }
        }

        return new JsonResponse(array(
            "host"          => gethostname(),
            "components"    => $syrupComponents,
            "documentation" => "http://documentation.keboola.com/syrup"
        ));
    }
public function indexAction ( ) { $ rootPath = str_replace ( 'web/../' , '' , ROOT_PATH ) ; $ filepath = $ rootPath . '/../../composer/installed.json' ; if ( ! file_exists ( $ filepath ) ) { $ filepath = $ rootPath . '/vendor/composer/installed.json' ; } $ installedJson = file_get_contents ( $ filepath ) ; $ jsonDecoder = new JsonDecode ( true ) ; $ installedArr = $ jsonDecoder -> decode ( $ installedJson , JsonEncoder :: FORMAT ) ; $ syrupComponents = array ( ) ; foreach ( $ installedArr as $ package ) { $ nameArr = explode ( "/" , $ package [ 'name' ] ) ; if ( $ nameArr [ 0 ] == 'syrup' || $ nameArr [ 0 ] == 'keboola' ) { $ syrupComponents [ $ package [ 'name' ] ] = $ package [ 'version' ] ; } } return new JsonResponse ( array ( "host" => gethostname ( ) , "components" => $ syrupComponents , "documentation" => "http://documentation.keboola.com/syrup" ) ) ; }
Displays Syrup components with their recent version

@return JsonResponse
Displays Syrup components with their recent version