Upload multiple files to an entity with Symfony4 and VichUploaderBundle

Code sur écran d'ordinateur

Preparation   To begin with, we need a Product entity as well as a ProductImage entity that will contain the names of the images. To do this, we use the command in our terminal VichUploaderBundle Setup As stated in the Symfony 4 documentation, we will use the VichUploaderBundle Then add the necessary “config/packages/vich_uploader.yaml” configuration file … Read more

Symfony – debug a Twig template with dump()

Code sur écran d'ordinateur

Twig’s {{ dump() }} function is very handy to inspect a variable inside a template. But without the right package installed, the output is unreadable. Here is how to get a clean, collapsible display like this one: Install the DebugBundle The nice output comes from Symfony’s VarDumper component, enabled by the DebugBundle. Install it as … Read more

Xdebug installation with PHP 5.6 on Ubuntu

MacBook avec code sur un bureau

First of all you have to install the xdebug package for PHP 5.6 sudo apt-get install php-xdebug Then you have to enable it so it is accessible from PhpStorm for example Edit the file sudo nano /etc/php/5.6/mods-available/xdebug.ini and add the following lines xdebug.remote_enable = on xdebug.remote_connect_back = on xdebug.idekey = “vagrant” The PHP service needs … Read more

Categories PHP

Docker: How to use XDebug with docker-compose

MacBook avec code sur un bureau

Docker In the docker-compose.yml file create an images/php image importer: build: images/php ports: – 80:80 volumes: – ../..:/var/www find your IP address (ifconfig / ipconfig), in my example (10.1.0.133) Create a Dockerfile in the images/php folder FROM php:7.0.1-apache RUN yes | pecl install -o -f xdebug \ && rm -rf /tmp/pear \ && echo “zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so” … Read more

Docker: How to use nano

MacBook Pro affichant un éditeur de code

To use nano in Docker, you have to update apt-get and install nano. When trying to open a file you may face the error Error opening terminal: unknown. No worries, just export the TERM=xterm variable apt-get update apt-get install nano export TERM=xterm