Php
info
You can enable the extra with the :LazyExtras
command.
Plugins marked as optional will only be configured if they are installed.
Alternatively, you can add it to your lazy.nvim
imports
lua/config/lazy.lua
require("lazy").setup({
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.lang.php" },
{ import = "plugins" },
},
})
Options
Additional options for this extra can be configured in your lua/config/options.lua file:
lua/config/options.lua
-- LSP Server to use for PHP.
-- Set to "intelephense" to use intelephense instead of phpactor.
vim.g.lazyvim_php_lsp = "intelephense"
Below you can find a list of included plugins and their default settings.
caution
You don't need to copy the default settings to your config. They are only shown here for reference.
nvim-treesitter
- Options
- Full Spec
opts = { ensure_installed = { "php" } }
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "php" } },
}
nvim-lspconfig
- Options
- Full Spec
opts = {
servers = {
phpactor = {
enabled = lsp == "phpactor",
},
intelephense = {
enabled = lsp == "intelephense",
},
[lsp] = {
enabled = true,
},
},
}
{
"neovim/nvim-lspconfig",
opts = {
servers = {
phpactor = {
enabled = lsp == "phpactor",
},
intelephense = {
enabled = lsp == "intelephense",
},
[lsp] = {
enabled = true,
},
},
},
}
mason.nvim
- Options
- Full Spec
opts = {
ensure_installed = {
"phpcs",
"php-cs-fixer",
},
}
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"phpcs",
"php-cs-fixer",
},
},
}
nvim-dap (optional)
- Options
- Full Spec
opts = function()
local dap = require("dap")
local path = require("mason-registry").get_package("php-debug-adapter"):get_install_path()
dap.adapters.php = {
type = "executable",
command = "node",
args = { path .. "/extension/out/phpDebug.js" },
}
end
{
"mfussenegger/nvim-dap",
optional = true,
opts = function()
local dap = require("dap")
local path = require("mason-registry").get_package("php-debug-adapter"):get_install_path()
dap.adapters.php = {
type = "executable",
command = "node",
args = { path .. "/extension/out/phpDebug.js" },
}
end,
}
none-ls.nvim (optional)
- Options
- Full Spec
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = opts.sources or {}
table.insert(opts.sources, nls.builtins.formatting.phpcsfixer)
table.insert(opts.sources, nls.builtins.diagnostics.phpcs)
end
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = opts.sources or {}
table.insert(opts.sources, nls.builtins.formatting.phpcsfixer)
table.insert(opts.sources, nls.builtins.diagnostics.phpcs)
end,
}
nvim-lint (optional)
- Options
- Full Spec
opts = {
linters_by_ft = {
php = { "phpcs" },
},
}
{
"mfussenegger/nvim-lint",
optional = true,
opts = {
linters_by_ft = {
php = { "phpcs" },
},
},
}
conform.nvim (optional)
- Options
- Full Spec
opts = {
formatters_by_ft = {
php = { "php_cs_fixer" },
},
}
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
php = { "php_cs_fixer" },
},
},
}