Laravel:部署和供应商文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17446816/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 08:04:44  来源:igfitidea点击:

Laravel: Deploy and vendor folder

deploymentlaravel

提问by MatterGoal

I've just finished a simple work done in Laravel 4 and I'm ready to Deploy on my server.

我刚刚在 Laravel 4 中完成了一项简单的工作,我准备在我的服务器上进行部署。

I found that the vendor folder has a size of 100MB and I wonder if it is necessary to upload all its subfolders. I suppose that I don't use the most of those libraries, is there a good practise to follow to deploy a Laravel project?

我发现vendor文件夹有100MB大小,不知道有没有必要上传所有的子文件夹。我想我不使用这些库中的大部分,是否有部署 Laravel 项目的好习惯?

回答by Antonio Carlos Ribeiro

You better use

你最好用

composer create-project laravel/laravel --prefer-dist <project directory>

To create your project. Your vendor dir space usage will start at 10MB, only. (I just did it it here and that's what downloaded for me).

创建您的项目。您的供应商目录空间使用量仅从 10MB 开始。(我只是在这里做的,这就是为我下载的)。

And looks like you also can:

看起来你也可以:

composer update --no-dev --prefer-dist

To reduce your current project space usage.

减少您当前的项目空间使用。

But... vendor directory and all its first level subdirectories are mandatory (as long as you are using all the packages you have installed), but there are some subdirectories inside them you may easily ignore when deploying, such as:

但是... vendor 目录及其所有第一级子目录是必需的(只要您使用已安装的所有软件包),但是其中有一些子目录您在部署时很容易忽略,例如:

*/examples/*
*/docs/*
*/docs2/* (Doctrine)
*/tests/*
*/test/*
*/Tests/* (Carbon)
*/swiftmailer/swiftmailer/notes/*

回答by Tim F

I haven't deployed an L4 app myself to this point, but will run into issues as I don't have git/composer access on my host server as well. Unless something clever comes along, FTP/SSH is my only avenue for getting my files on the server.

到目前为止,我自己还没有部署 L4 应用程序,但会遇到问题,因为我的主机服务器上也没有 git/composer 访问权限。除非出现一些聪明的东西,否则 FTP/SSH 是我在服务器上获取文件的唯一途径。

The /vendorsfolder is absolutely requiredin order for your application to function. Think of vendors as the /corefolder in other frameworks. All of the heavy lifting in Laravel is managed through the packages contained inside of /vendors, and so without that folder your app will just crash.

为了让您的应用程序正常运行,绝对需要/vendors文件夹。将供应商视为其他框架中的文件夹。Laravel 中的所有繁重工作都通过包含在./core/vendors

回答by Karl Laurentius Roos

You should not upload the vendor folder, insted you should run composer install/update on your server where you deploy. You should only deploy your application files.

你不应该上传供应商文件夹,你应该在部署的服务器上运行 composer install/update。您应该只部署您的应用程序文件。