Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # PHPStorm setup
- ## Enable Symfony plugin
- - `File` -> `Settings` -> `Languages & Frameworks` -> `PHP`
- - `Symfony` -> `Enable Plugin for this Project (change need restart)`
- - `OK`
- - Restart PHPStorm
- ## Configure PHP CLI Interpreter
- - `File` -> `Settings` -> `Languages & Frameworks` -> `PHP`
- - `PHP language level`: 7.4
- - `CLI Interpreter` -> `...` -> `+` -> `From Docker, Vagrant, VM, WSL, Remote...` -> `Docker Compose`
- - `Service`: app
- - `OK`
- - `Lifecycle`: Connect to existing container ('docker-compose exec')
- - Check that Xdebug was found
- - `OK`
- - `OK`
- ## PHP CS Fixer & PHPStan
- These tools require to be installed. For sake of speed it is recommended to use them locally. So you need to have php installed locally to do that. (it is possible to run them using docker-compose app)
- So to get them locally in existing project then start container with dir mounted and install these tools:
- ```
- cp docker-compose.override.yml.dist docker-compose.override.yml
- docker-compose up -d
- docker-compose exec app app-build
- docker-compose down
- ```
- Then proceed with configuraiton:
- ### Enable code checks:
- - `File` -> `Settings` -> `Editor` -> `Inspections` -> `Quality tools`
- - `PHP CS Fixer validation`: check
- - `PHPStan validation`: check
- ### Configure tools:
- - `File` -> `Settings` -> `Languages & Frameworks` -> `PHP` -> `Quality tools`
- - `PHP CS Fixer` -> `Configuration`: local
- - `...` -> `PHP CS Fixer path`: tools/php-cs-fixer
- - `Validate`
- - `OK`
- - `PHPStan` -> `Configuration`: local
- - `...` -> `PHPStan path`: vendor/bin/phpstan
- - `Validate`
- - `OK`
- - `OK`
- ### Auto format
- Then you should be able to open php file and see warning notices.
- Auto fix them with:
- - `Code` -> `Reformat Code`
- ## Phpunit
- ### Configure phpunit paths
- - `File` -> `Settings` -> `Languages & Frameworks` -> `PHP`
- - `Test Frameworks`
- - Click trough existing tools and find phpunit one
- - Validate "PHPUnit library" config
- - `Use Composer autoloader`
- - `Test Runner` -> `Default configuration file`: {full local path to phpunit.xml.dist}
- ### Create phpunit runner
- - `Run` -> `Edit configuration`
- - `+` -> `PHPUnit`
- - `Name`: phpunit
- - `Test Runner`
- - `Test scope`: Defined in the configuration file
- - `Interpreter`: app
- - `OK`
- Use it from within PHPStorm
- ```
- Run -> Run 'phpunit' with Coverage
- ```
- ## Debug cli command
- - `Run` -> `Edit configuration`
- - `+` -> `PHP Script`
- - `Name`: app:test
- - `File`: bin/console
- - `Arguments`: app:test
- - `Interpreter`: app
- - `OK`
- Use it from within PHPStorm
- Open: `src/Command/TestCommand.php`
- Add breakpoints and run script
- - `Run` -> `Debug 'app:test'`
- ## Composer script: grump
- - `File` -> `Settings` -> `Languages & Frameworks` -> `PHP`
- - `Composer`
- - `Execution` -> `CLI Interpreter`: app
- - `OK`
- ### Run composer command:
- - `Tools` -> `Composer` -> `Validate`
- ### Create grump script:
- - `Run` -> `Edit configuration`
- - `+` -> `Composer Script`
- - `Name`: `grump`
- - `Script`: `grump`
- - `OK`
- ## WEB debug
- This setup is tested using `devs` reverse proxy running.
- Create new server with correct mapping.
- - `File` -> `Settings` -> `Languages & Frameworks` -> `PHP` -> `Servers`
- - `+`
- - `Name`: `sylius-server`
- - `Host`: `*`
- - `Port`: `8080`
- - `Use path mapping`
- - For root path add: `/var/www/app`
- - `OK`
- Then start listening for xdebug requests:
- `Run` -> `Start Listening for PHP Debug Connections`
- `Run` -> `Break at first line in PHP scripts`
- Install browser toolbar
- https://www.jetbrains.com/help/phpstorm/2020.3/browser-debugging-extensions.html
- Open app website:
- https://de_de.sylius.localhost/
- Turn debugger toolbar on
- Refresh page and switch PHPStorm
Add Comment
Please, Sign In to add comment