How to install Symfony4 in Netbeans?

10,390

In case anyone is still stopping on this question, I've gotten Apache Netbeans 11.1 and 11.2 to work really well with Symfony 4 + projects. Here's what I did:

  1. Created project using Symfony instructions and terminal commands.
  2. Open Netbeans and make sure PHP is installed and active in plugins menu.
  3. Open the project in Netbeans. Netbeans will automatically detect that it is a PHP project.
  4. Right click your project name in the Projects window. Select the Properties wizard all the way at the bottom of the menu and do the following:

    a. Under Sources bullet, revise the Path for the Source Folder to include your entire project instead of the src folder of your project. That way you can access all the files/folders in your project. Also, select your PHP version (you should probably use the latest if you just started a new project).

    b. Under Run Configuration bullet, select Run As "Local Web Site" to use the Symfony development server (see below issues). If using Symfony development server, also put "http://localhost:8000/" for Project URL.

    c. Go all the way down to Frameworks. Select Doctrine2 and enable it. Select Symfony 3 and enable it. Also, Important: replace whatever is indicated for App Directory with bin.

    d. Click OK and close the Properties Wizard.

That should be it for configuration. In order to access all the great Symfony bin/console commands in Netbeans without having to go to the terminal, right click the Project name in the Projects window, click Symfony, then click 'Run Command' and scroll down till you get to the command you want. It will also give you a description of the what the command does. You can even provide parameters with the command. If this isn't working for you, make sure you did part 4.c. above correctly and make sure you actually have the Symfony plugins installed that actually give you the commands you need (i.e., check your composer.json file and run install if you haven't already).

Debugging: This is different issue probably is covered somewhere else. However, I've been able to get xdebug working with Chrome and Netbeans will start the browser with the debug project command, listen to the proper port and do line stops, etc.

Two Issues:

  1. Symfony 5 now uses global server commands so the server:run, server:start, etc. are no longer locally in bin/console. See discussion here for options. You can either download the older version to use in bin/console (in which case Netbeans will then load it with all the other bin/console commands) or just start/stop the Symfony 5 server from the terminal.

  2. You may get an error in the vendor folder. I haven't been able to get rid of this. It may be PHP version conflicts or something else. Whatever the case, using Netbeans Options/Miscellaneous/Files menu, you might be able to find a way to ignore the vendor folder, ignore errors in the folder, resolve a php version conflict, or just live with the error.

Share:
10,390
user7430779
Author by

user7430779

Updated on June 09, 2022

Comments

  • user7430779
    user7430779 almost 2 years

    I keep rereading the NetBeans documentation to try to install the symfony 4 I find How to install symfony 2/3 but not symfony4. is there any one know how to install symfony 4 in NetBeans?