spacemacs/layers/+lang/php
syl20bnr 584392bd92 [core] Fix layer dependencies based on layer variables
There was a edge case with the declaration of the `lsp` layer in `layers.el`
files.
The `hy` layer depends on the `python` layer which in turn depends on the `lsp`
layer if and only if the `python-backend` layer variable is set to `lsp`.
When the `hy` layer was declared first then it declares the `python` layer
without its layer variables, thus the `lsp` layer was not declared because the
`python-backend` variable was not set.

The fix is to gather all the layer dependencies and resolve them only after all
the used layers have been declared.

* new function `configuration-layer/declare-layer-dependencies`
* replace all calls to `configuration-layer/declare-layer` by the new function
  except for distribution layers (we declare layer dependencies right away in
  distribution layers)
2019-09-30 02:00:48 -04:00
..
img
config.el [lsp] When used, make LSP the default backend for all supported lang 2019-09-30 00:49:44 -04:00
funcs.el [lsp] When used, make LSP the default backend for all supported lang 2019-09-30 00:49:44 -04:00
layers.el [core] Fix layer dependencies based on layer variables 2019-09-30 02:00:48 -04:00
packages.el [php] Enable evil-matchit-mode 2019-09-27 13:35:29 +02:00
README.org [lsp] When used, make LSP the default backend for all supported lang 2019-09-30 00:49:44 -04:00

PHP layer

/TakeV/spacemacs/media/commit/ec0a535b2710a13ce19526a12de24d67f7e4259c/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.

Backends

For php you have the choice between a set of possible LSP backends with different setup instructions and different capabilities.

Note that you'll need to use the lsp layer to enable these backends.

intelephense

This is the recommended LSP server solution. To activate it set the layer variable php-backend:

  (php :variables php-backend 'lsp)

and install the npm server with:

  npm install -g intelephense

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

php-language-server

This is an alternative LSP server implementation working on PHP basis rather than nodejs. To activate it set the layer variable php-backend like for the intelephense backend and install the server via composer:

  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.

ac-php-core

This is a non server solution working entirely from an elisp package. This requires no installation of external services but also delivers the least amount of IDE like integrations with spacemacs.

To activate it just don't set the variable php-backend in your dotfile. Remember that additional setup instructions are necessary on a per project basis which you can find below.

Setup

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.

Key bindings

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