My solution without the need to install php_codesniffer globally.
Just go to VSCode settings and define the local path ./vendor/squizlabs/php_codesniffer/bin/phpcs
Or you can set the path directly in your settings.json
"phpcs.executablePath": "./vendor/squizlabs/php_codesniffer/bin/phpcs"