phpcd is a autocompletion plugin for vim. It integrates well with deoplete, providing useful suggestions when coding in php.
Requirements
- msgpack php extension
- pcntl php extension
Configuring on macOS
Step 1: Install PHP via brew
As the stock PHP bundled with macOS does not include pcntl, we install a build of php from homebrew which comes with pcntl preinstalled.
$ brew install php
Make sure the php path is updated:
$ which php
# /usr/local/bin/php << expected output1
Step 2: Install msgpack php extension via pecl
If you install php via brew, pecl should also come pre-installed:
$ pecl install msgpack
Confirm msgpack is install by running
$ php -m
and make sure msgpack
is displayed on the output
Step 3: Install phpcd
Follow the installation instructions on the Github repo. Install using your favorite plugin manager and add the necessary configs to your vimrc file.
If it’s not working, you might need to manually run composer install
in the phpcd.vim directory…
Bonus: Laravel Facades support
If you have a Laravel project, you could have facades autocompletion support with the Laravel IDE Helper composer package. Refer to this issue to set it up.
Adwin Ying
Self-taught full-stack web dev based in Tokyo.
Occasionally wrecks servers through
self-hosting
and
homelab-ing.