spacemacs/layers/+lang/php
2019-09-17 13:03:01 +02:00
..
img Use + instead of ! for layer categories 2015-09-11 00:13:51 -04:00
config.el [php] Enable experimental lsp support 2019-09-17 12:53:43 +02:00
funcs.el [php] Enable experimental lsp support 2019-09-17 12:53:43 +02:00
layers.el [php] Make layer depend on LSP layer if lsp backend is activated 2019-09-17 13:03:01 +02:00
packages.el [php] Enable experimental lsp support 2019-09-17 12:53:43 +02:00
README.org [php] Make layer depend on LSP layer if lsp backend is activated 2019-09-17 13:03:01 +02:00

PHP layer

/TakeV/spacemacs/media/commit/020a8b474dbfaeaac17a659a27132a18139fa127/layers/+lang/php/img/php.png

Description

This layer adds PHP language support to Spacemacs.

Features:

The gtags layer is recommended to benefit from better eldoc and helm-gtags.

Install

Layer

To use this configuration layer, add it to your ~/.spacemacs. You will need to add php to the existing dotspacemacs-configuration-layers list in this file.

Setting the backend

To activate the backend set the layer variable php-backend:

  (php :variables php-backend 'lsp)

Backend

Language Server Protocol

lsp-mode currently supports two lsp backends for php. When both are installed, the former takes priority over the latter:

intelephense

  nmp install -g intelephense

You can find further information on the project's website and GitHub page.

php-language-server

  composer require felixfbecker/language-server
  composer run-script --working-dir=vendor/felixfbecker/language-server parse-stubs

You can find further information on the project's GitHub page.

Key bindings

Key binding Description
SPC m g g jump to define at point
C-t jump back

Usage

Because of the way that the ac-php-core package works, there are a couple of simple initialization tasks which must occur to get the completion working as it should. On any new project make sure to perform the following initialization tasks:

  1. Run the following

      cd /root/of/project
      touch .ac-php-conf.json
  2. Inside of spacemacs run: = ac-php-remake-tags =

The .ac-php-conf.json file is required to enable auto-completion. When you run ac-php-remake-tags and your .ac-php-conf.json file is empty the default configuration will be used and inserted in the file.

If your project contains the following files at the root folder:

  1. .projectile
  2. vendor/autoload.php

the necessary configuration file (.ac-php-conf.json) will be created automatically if it does not exist.