PHP: Difference between revisions
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
=Setting up VS Code= | =Setting up VS Code= | ||
==Extensions== | |||
We need to install | We need to install | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 11: | Line 12: | ||
*Twig Language 2 | *Twig Language 2 | ||
*SQLTools | *SQLTools | ||
==Debugger== | |||
Had a bit of grief tracking this down but found these steps worked for me<br> | |||
<br> | |||
Step One | |||
<syntaxhighlight lang="bash"> | |||
sudo apt install php-xdebug | |||
</syntaxhighlight> | |||
Step Two - Edit xdebug.ini | |||
<syntaxhighlight lang="bash> | |||
sudo vi /etc/php/7.4/mods-available/xdebug.ini | |||
</syntaxhighlight> | |||
Add to the end | |||
<syntaxhighlight lang="ini"> | |||
zend_extension=/usr/lib/php/20190902/xdebug.so | |||
xdebug.mode = debug | |||
xdebug.start_with_request = yes | |||
xdebug.client_port = 9000 | |||
</syntaxhighlight> | |||
Step 3 - Create a launch | |||
<syntaxhighlight lang="json"> | |||
{ | |||
"version": "0.2.0", | |||
"configurations": [ | |||
{ | |||
"name": "Listen for XDebug", | |||
"type": "php", | |||
"request": "launch", | |||
"port": 9000, | |||
}, | |||
{ | |||
"name": "Launch currently open script", | |||
"type": "php", | |||
"request": "launch", | |||
"program": "${file}", | |||
"cwd": "${fileDirname}", | |||
"port": 9000 | |||
} | |||
] | |||
} | |||
</syntaxhighlight> | |||
=Creating Project With Composer= | =Creating Project With Composer= | ||
To create a project you need to run the following. The only tricky bit is the name where they want vendor/name e.g. bibble/test | To create a project you need to run the following. The only tricky bit is the name where they want vendor/name e.g. bibble/test |
Latest revision as of 11:24, 30 May 2021
Setting up VS Code
Extensions
We need to install
sudo apt install php-cli composer php-xml
You will need to set up php-cs-fixer first. Extensions suggested are
- PHP Intelephense
- PHP Getters & Setters
- PHP debug
- PHP CS Fixer
- Twig Language 2
- SQLTools
Debugger
Had a bit of grief tracking this down but found these steps worked for me
Step One
sudo apt install php-xdebug
Step Two - Edit xdebug.ini
sudo vi /etc/php/7.4/mods-available/xdebug.ini
Add to the end
zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
Step 3 - Create a launch
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
Creating Project With Composer
To create a project you need to run the following. The only tricky bit is the name where they want vendor/name e.g. bibble/test
composer init