简体   繁体   中英

How to install Symfony4 in Netbeans?

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?

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 (ie, 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.

You could do it via composer package manager by executing following command, if you want to create new project:

composer create-project symfony/symfony:2.3.* project-name

or, if you want to include symfony into your existing project, execute following command into your project directory:

composer require symfony/symfony:2.3.*

It will install latest version of symfony 2.3 branch which currently is equal to 2.3.42. If you need another one version, you just replace the one, that I have mentioned as the example. The information on how to install composer on your system can be easily found via internet. Good luck!

NETBEANS 8.* and Symfony 4.*

Please stop being frustrated by Symfony 4.

[For MS Windows AND NETBEANS]

Step 1: Install the newest version of Xampp or *ampp.

    *If not the newest version, it can conflict with Composer-Setup.exe.*

Step 2: Download Composer-Setup.exe and execute it

Step 3: Use git bash or other

Step 4: Create a project in any location of hard disk by pasting into git bash prompt or other

 $ composer create-project symfony/website-skeleton Symfony

step 5: Please use "Windows search" to find out Symfony

step 6: Zip all the files under folder Symfony

step 7: in NetBeans IDE --> Tools > Options > PHP > Frameworks & Tools > Symfony 2/3':

Check 'Sandbox:' and click 'Browse' to the Symfony.zip compressed by you.

Click 'OK'

NetBeans PHP Symfony Sandbox

step 8:

Create new project PHP Application

in the Run Configuration step Select Run As: PHP Built-in Web Server (running on built-in web server)

in the PHP Frameworks step select Symfony 2/3 PHP Web Framework and click Finish

Run Configuration

Step 9: click with the right button on the created project. Select properties> Frameworks> Symfony 3 You can see App Directory : app on the right.

Please change the app to config. And click 'OK'.

Step 10: Click and open Your 'PhpProject' > Source Files > public > index.php and right click on index.php and click 'run' on the new window.

How to install symfony 4 to netbeans 1. first install symfony 4 composer create-project symfony/skeleton my_project_name

  1. Install orm pack composer req symfony/orm-pack

  2. in menu project right-click choose new-project->php application->browse the project->next->

  3. install this web server bundle if you want composer require --dev symfony/profiler-pack // composer require --dev symfony/web-server-bundle

You don't install Symfony in Netbeans or any other IDE for that matter. Symfony is a PHP Framework and it has nothing to do with your text editor.

Symfony is a collection of PHP components which allows you to create more secure, robust and better code.

You can use Netbeans to write some code based on Symfony framework.

If you want to get Symfony please follow this documentation:

https://symfony.com/doc/current/setup.html

What you are referring to is just a Symfony plugin which makes it easier to write Symfony code. I recommend using PHPStorm. You can get a free trial version for a month and then I think free test version for another month. That is at least two months of development. PHPStorm has amazing support for Symfony.

I hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM