Skip to content

Instantly share code, notes, and snippets.

@brunobolting
Last active February 21, 2021 23:00
Show Gist options
  • Save brunobolting/1327d0d9bf85ee16a88a65b944afdb3e to your computer and use it in GitHub Desktop.
Save brunobolting/1327d0d9bf85ee16a88a65b944afdb3e to your computer and use it in GitHub Desktop.

Vs Code Configuration for PHP

Requisito:

  • Ter o composer instalado

1. Instalar as extensões

Recomendados:

  • PHP Intelephense
  • phpcs (Ioannis Kappas)
  • PHP Debug
  • PHP DocBlock
  • DotENV
  • Bracket Pair Colorizer 2
  • Partial Diff

Opcionais:

  • Dracula Official
  • GitLens
  • VsCode Great Icons

1.1 Desinstalar extensão nativa do vscode

Vá para aba Extensions

Pesquise: @builtin php

Desabilite a extensão PHP Language Features

2. Instalar dependencias com composer globalmente

Instalando PHPCS

$ composer global require squizlabs/php_codesniffer

3. Editar o settings.json do Vscode

Substitua o código do settings.json pelo código abaixo, você pode ou não manter suas configurações, e fique a vontade pra editar a sua maneira.

{
    "workbench.colorTheme": "SynthWave '84",
    "editor.fontFamily": "Fira Code, Monospace",
    "window.zoomLevel": 0,
    "editor.fontWeight": "400", // Regular
    "editor.fontSize": 14,
    "editor.insertSpaces": true,
    "editor.useTabStops": true,
    "editor.tabSize": 4,
    // "editor.letterSpacing": 0.5,
    "editor.lineHeight": 24,
    "editor.cursorBlinking": "smooth",
    "editor.fontLigatures": true,
    "editor.formatOnType": false,
    "editor.formatOnPaste": false,
    "telemetry.enableCrashReporter": false,
    "telemetry.enableTelemetry": false,
    "search.exclude": {
        "**/node_modules": true,
        "**/vendor" : true,
        "**/.git": true,
    },
    "files.eol": "\n",
    "files.insertFinalNewline": true,
    "files.trimTrailingWhitespace": true,
    "files.associations": {
        "*.blade.php": "html",
        "*.twig": "html",
        "*.php": "php",
        "*.vue": "vue",
        "*.php-cs": "php",
        "*.module": "php",
        "htm": "php"
    },
    "editor.rulers": [
        120
    ],
    "php.validate.enable": false,
    "php.suggest.basic": false,
    "editor.autoIndent": "advanced",
    "git.showPushSuccessNotification": true,
    // "scm.diffDecorations": "none",
    "editor.codeLens": true,
    "editor.cursorStyle": "line",
    "outline.problems.enabled": true,
    "explorer.autoReveal": true,
    "editor.gotoLocation.multipleDefinitions": "goto",
    "explorer.confirmDragAndDrop": true,
    "explorer.openEditors.visible": 10, //
    "editor.snippetSuggestions": "bottom",
    "editor.emptySelectionClipboard": false,
    "workbench.sideBar.location": "left",
    "workbench.enableExperiments": false,
    "workbench.statusBar.visible": true,
    "npm.enableScriptExplorer": false,
    "workbench.iconTheme": "vscode-great-icons",
    "git.enabled": true,
    "intelephense.stubs":[
        "apache",
        "bcmath",
        "bz2",
        "calendar",
        "com_dotnet",
        "Core",
        "ctype",
        "curl",
        "date",
        "dba",
        "dom",
        "enchant",
        "exif",
        "fileinfo",
        "filter",
        "fpm",
        "ftp",
        "gd",
        "hash",
        "iconv",
        "imap",
        "interbase",
        "intl",
        "json",
        "ldap",
        "libxml",
        "mbstring",
        "mcrypt",
        "meta",
        "mssql",
        "mysqli",
        "oci8",
        "odbc",
        "openssl",
        "pcntl",
        "pcre",
        "PDO",
        "pdo_ibm",
        "pdo_mysql",
        "pdo_pgsql",
        "pdo_sqlite",
        "pgsql",
        "Phar",
        "posix",
        "pspell",
        "readline",
        "recode",
        "Reflection",
        "regex",
        "session",
        "shmop",
        "SimpleXML",
        "snmp",
        "soap",
        "sockets",
        "sodium",
        "SPL",
        "sqlite3",
        "standard",
        "superglobals",
        "sybase",
        "sysvmsg",
        "sysvsem",
        "sysvshm",
        "tidy",
        "tokenizer",
        "wddx",
        "xml",
        "xmlreader",
        "xmlrpc",
        "xmlwriter",
        "Zend OPcache",
        "zip",
        "zlib"
    ],
    "intelephense.telemetry.enabled": false,
    "intelephense.format.enable": true,
    "intelephense.completion.triggerParameterHints": true,
    "intelephense.completion.insertUseDeclaration": true,
    "intelephense.completion.fullyQualifyGlobalConstantsAndFunctions": true,
    "intelephense.trace.server": "messages",

    "phpcs.executablePath": "/home/brunobolting/.config/composer/vendor/bin/phpcs",
    "phpcs.enable": true,
    "phpcs.autoConfigSearch": true,
    "phpcs.standard": "PSR12",
    "phpcs.showWarnings": true,
    "phpcs.showSources": true,
    "phpcs.ignorePatterns": [
        "**/.git/**",
        "**/.svn/**",
        "**/.hg/**",
        "**/CVS/**",
        "**/.DS_Store/**",
        "**/node_modules/**",
        "**/bower_components/**",
        "**/storage/**",
        "**/resources/views/**",
        "**/database/migrations/**",
        "**/tests/**",
        "**/storage/framework/views/**",
        "**/vendor",
        "_ide_helper.php",
        "_ide_helper_models"
    ],
    "php-docblocker.returnGap": true,
    "php-docblocker.qualifyClassNames": true,
    "php-docblocker.author": {"name": "Dev", "email": "dev@dotgroup.com"},
    "search.collapseResults": "alwaysCollapse",
    "search.showLineNumbers": true,
    "[shellscript]": {
        "editor.insertSpaces": true,
        "editor.useTabStops": true,
        "editor.tabSize": 4,
        "editor.wordBasedSuggestions": true,
        "editor.autoIndent": "advanced",
    },
    "gitlens.codeLens.enabled": false,
    "explorer.compactFolders": false,
    "task.autoDetect": "off",
    "explorer.confirmDelete": false,
    "todo-tree.tree.showScanModeButton": false,
    "liveServer.settings.donotShowInfoMsg": true,
    "diffEditor.ignoreTrimWhitespace": false,
    "workbench.startupEditor": "newUntitledFile"
}

É isso, seu vscode está pronto =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment