简体   繁体   English

netbeans 中的新 Laravel 项目

[英]New laravel project in netbeans

My friends helped me to install composer, laravel I have also downloaded some laravel projects through SVN.朋友帮我安装了composer,laravel 我也通过SVN下载了一些laravel项目。 I just wanted to start my own another laravel project.我只是想开始我自己的另一个 Laravel 项目。 After hours spent on reading about it I honestly do not understand how to create a new laravel project in netbeans.在花了几个小时阅读它之后,老实说,我不明白如何在 netbeans 中创建一个新的 Laravel 项目。 After clicking new project there is option of chosing framework like zend or symphony but my laravel is not there.单击新项目后,可以选择像 zend 或 Symphony 这样的框架,但我的 laravel 不在那里。 Could someone advide me please?有人可以给我建议吗?

EDIT: I can see a lot of views on this topic so I will just say that it is only necessary to install composer, do everything according to laravels manual and only open the project through netbeans, not create it there directly.编辑:我可以看到很多关于这个主题的观点,所以我只想说只需要安装composer,按照laravel手册做所有事情,只通过netbeans打开项目,而不是直接在那里创建。

The above solution gave me a lot of errors and eventually I gave up, I've found a much cleaner way to setup a minimal Laravel application by using a seed project.上面的解决方案给了我很多错误,最终我放弃了,我找到了一种更简洁的方法来使用种子项目设置最小的 Laravel 应用程序。

Tested in Netbeans 8.2 (I think it should work on all 8 versions).在 Netbeans 8.2 中测试(我认为它应该适用于所有 8 个版本)。

  1. Install Composer on your system在您的系统上安装Composer
  2. Installer the Composer plugin for Netbeans (It's in the plugins menu, under the PHP category).为 Netbeans 安装 Composer 插件(它在插件菜单中,在 PHP 类别下)。
  3. New Project > PHP Application新建项目 > PHP 应用程序
  4. Go though the wizard, and setup your project.通过向导,并设置您的项目。 the last step should be named Composer最后一步应该命名为Composer
  5. In the last step, search (under Token: ) for laravel在最后一步,搜索(在Token:laravel
  6. Select laravel/laravel: The Laravel Framework.选择laravel/laravel: The Laravel Framework. and move it to the selected frameworks on the right并将其移动到右侧的选定框架
  7. Click Finish , and you're Done!点击Finish ,你就完成了!

    在此处输入图片说明

If you read the Installation section from the Laravel Docs you'll see that you only need to run a couple of commands to create a new Laravel app.如果你阅读了 Laravel 文档中的安装部分,你会发现你只需要运行几个命令来创建一个新的 Laravel 应用程序。 Open a terminal (command prompt if you're on Windows) and type the following commands:打开终端(如果您使用的是 Windows,则为命令提示符)并键入以下命令:

1. Get the Laravel installer: 1.获取 Laravel 安装程序:

composer global require "laravel/installer=~1.1"

2. Go to the directory you want to install Laravel in: 2.进入你想要安装 Laravel 的目录:

cd path/to/directory

3. Then make sure you have added the composer vendor directory to the PATH system variable ( instructions ) by appending the following (of course, replace [username] in that path with your actual Windows username): 3.然后通过附加以下内容(当然,将路径中的[username]替换为您的实际 Windows 用户名),确保您已将 composer vendor 目录添加到 PATH 系统变量( 指令):

;C:\\Users\\[username]\\AppData\\Roaming\\Composer\\vendor\\bin\\ ;C:\\Users\\[用户名]\\AppData\\Roaming\\Composer\\vendor\\bin\\

4. Create a new Laravel: 4.创建一个新的 Laravel:

laravel new myapp

The last command will create the app in path/to/directory/myapp .最后一个命令将在path/to/directory/myapp创建应用程序。 Then all you need to do is create a new project and selecting the source folder you just created your Laravel application in:然后你需要做的就是创建一个新项目并选择你刚刚创建你的 Laravel 应用程序的源文件夹:

Setting up a PHP Project in the NetBeans IDE for PHP 在 NetBeans IDE 中为 PHP 设置 PHP 项目

  1. install JDK 15 for Apache Netbeans 12为 Apache Netbeans 12 安装 JDK 15

    install cygwin "by internet" option安装cygwin“通过互联网”选项

    install composer安装作曲家

  2. create and define projects folder in root one (user )在根目录(用户)中创建和定义项目文件夹

  3. in command prompt : cd path-to your-netbeans-projects在命令提示符中: cd path-to your-netbeans-projects

    composer global require laravel/installer

    composer create-project laravel/laravel mockProject

  4. launche IDE, install Nodejs plugin启动IDE,安装Nodejs插件

    file->open project, select your project file->open项目,选择你的项目

  5. if it will ask to resolve something with the project templates .allow that (the project can have yellow exclamation mark over its name, rightclick->resolve project something->ok )如果它会要求使用项目模板解决某些问题。

  6. in bar on top Tools->Open in terminal (if is present)在顶部的栏中Tools->Open in terminal (如果存在)

  7. right click on project name and choose Composer-> Add dependency右键单击项目名称并选择 Composer-> 添加依赖项

  8. in search field write laravel , tap Search and in the list below add 2 of barryvdh-*** wait while dependencies get recognized and click Require you can add other dependencies by typing in search field eg blade or javascript as needed在搜索字段中写入 laravel ,点击搜索并在下面的列表中添加 2 个 barryvdh-*** 等待依赖项被识别并单击 Require 您可以根据需要通过在搜索字段中输入例如刀片或javascript来添加其他依赖项

  9. type in terminal php path/to/project/folder/artisan serve .输入终端php path/to/project/folder/artisan serve Later you can open C:\\cygwin64\\home\\my_user_name\\bashrc file put in at the end cd path/to/project/folder string to enable run artisan without path trailing稍后您可以打开C:\\cygwin64\\home\\my_user_name\\bashrc文件放在末尾cd path/to/project/folder string 以启用 run artisan without path trailing

  10. You should get this in browser:你应该在浏览器中得到这个: 在此处输入图片说明

It won't support blade as it looks but its not essential.它不会像看起来那样支持刀片,但它不是必需的。 The essential one is the speed.最重要的是速度。

Edit I don't use the cygwin anymore.编辑我不再使用 cygwin 了。 Do things with console instead.用控制台做事。 Its pretty enough to cd to the root of project and launch php artisan commands so far到目前为止,它足以 cd 到项目的根目录并启动 php artisan 命令

Type this command composer create-project --prefer-dist laravel/laravel name in terminal .在终端中键入此命令composer create-project --prefer-dist laravel/laravel name Where name is your project name.其中 name 是您的项目名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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