php - 如何在 IntelliJ IDEA 中配置 Laravel 项目结构?

标签 php laravel intellij-idea

我应该将哪些文件夹标记为 Sources/Resources/Excluded?

enter image description here

最佳答案

我自己的逻辑基于the PHPStorm guide

来源

The root folder

推理:您的源代码可以位于根目录下的多个文件夹中。

替代方案:只需标记您在 app, bootstrap, config, routes, (more...)

中包含代码的真实文件夹

Click this button to mark the selected folder as the root for namespaces used in your project. Based on this setting, PhpStorm suggests you the proper folder name when you want to create a new namespace under another parent namespace during creation or moving a PHP class, that is, when you are actually creating or moving a PHP class to a non-existing namespace under another parent namespace. If no Sources folder is specified, you will have to type the proper folder manually.

Appointing a Sources folder is not mandatory but this helps you keep your project structure in compliance with the PSR0 and PSR4 standards. See Configuring PHP Namespaces in a Project for details.

测试

tests

推理:由于显而易见的原因,您的测试默认存在于此。您可能会为位于另一个文件夹中的 javascript 代码使用一些测试库。

Click this button to mark the selected folder as a test root.

排除

vendor, storage, node_modules

推理:我们在项目中使用的所有( Composer )库都在 vendor 中,但不是我们自己的代码。我们不应该默认搜索它。 在存储实时缓存文件时,对我们没有重要意义的文件,我们不会在版本控制(如供应商)中跟踪它们。我们可以删除它们,应用程序仍然可以工作。与 node_modules 相同,但此目录用于 javascript 包。

Click this button to mark the selected folder as excluded so PhpStorm ignores it during indexing, parsing, and code completion.

资源根

public

推理:您自己的前端 Assets 应该(某处)在公共(public)文件夹下以提供给浏览器。前端 Assets (主要是?)文件、javascript 和 css。

Click this button to enable PhpStorm to complete relative paths to resources under the selected folder.

关于php - 如何在 IntelliJ IDEA 中配置 Laravel 项目结构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45181909/

相关文章:

php - 在 Laravel 中搜索数组

php - 如何让 w3school 的联系表给我发电子邮件?

java - 如何在提交时删除 Intellij IDEA 中未使用的导入?

PHP 将从 BLOB 而不是从 MySQL 表中的 LONGBLOB 生成 jpg 图像

php - Laravel 从 'belongsTo' 关系获取 'hasMany' 关系

mysql - 使用 eloquent 从一种形式在多个模型中创建记录

php - 拉拉维尔 : How to run query for user input in sql?

debugging - 调试时进入项目类

java - 确保 MAVEN_HOME 设置正确

php - MySQL 选择(Zend Framework 数据库选择)