使用 composer 安装 Laravel 4 包
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21499339/
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
Laravel 4 Package installation using composer
提问by Arryangga Aliev Pratamaputra
I need to know how to install packages in laravel 4.
我需要知道如何在 laravel 4 中安装软件包。
I have downloaded a bundle from github, but executing the bundle
, I see it is deprecated in Laravel 4. Can anyone please help me.
我已经从 github 下载了一个包,但是执行bundle
,我发现它在 Laravel 4 中已被弃用。任何人都可以帮助我。
回答by Arryangga Aliev Pratamaputra
Just using packagist, you can go to packagist.org, after that just put the package name at require key in your composer.json
on your laravel project, and that run this command , composer update
or compose install
只需使用 packagist,您就可以转到packagist.org,之后只需将包名称composer.json
放在 laravel 项目中的 require 键,然后运行此命令,composer update
或compose install
in example :
例如:
// composer.json
"require": {
// default value..
"intervention/image": "dev-master",
}
i hope this help
我希望这有帮助
回答by majidarif
Laravel 4 now uses composer to install packages.
Laravel 4 现在使用 composer 来安装包。
You can add new packages to laravel via a few options on composer. One is on the command line.
您可以通过 Composer 上的一些选项向 Laravel 添加新包。一种是在命令行上。
> composer require author/package
> dev-master
After issuing the require command it will ask you what version to use. then run composer update
, add the PackageServiceProvider to your app/config/app.php
发出 require 命令后,它会询问您要使用的版本。然后运行composer update
,将 PackageServiceProvider 添加到您的app/config/app.php
回答by Miroslav Trninic
First and always if you plan to use composer in your work, learn the basics of it (what is composer.json,composer.lock...) There is excellent video on Laracasts https://laracasts.com/lessons/you-must-use-composerThat way you can avoid problems and enjoy using this great package manager.
首先,如果你打算在你的工作中使用 composer,学习它的基础知识(什么是 composer.json、composer.lock...) Laracasts 上有很棒的视频https://laracasts.com/lessons/you- must-use-composer这样你就可以避免问题并享受使用这个伟大的包管理器。
Next use composer dump(-autoload) command frequently and composer self-update.
接下来经常使用 composer dump(-autoload) 命令并进行 composer 自我更新。
If that bundle is deprecated in Laravel4 than it is deprecated and you can't use it ( unless author made some changes and adopt it for l4 ) Also bundle is a l3 specific type and in l4 we have packages.
如果该捆绑包在 Laravel4 中被弃用,则它已被弃用并且您不能使用它(除非作者进行了一些更改并将其用于 l4 )此外,bundle 是 l3 特定类型,并且在 l4 中我们有包。
回答by cha1988
Ok, you can't execute composer commands on windows command prompt. mac/linux terminal would do but if you insist on using windows then install this[https://www.cygwin.com/]so you could issue unix commands
好的,您无法在 Windows 命令提示符下执行 composer 命令。mac/linux 终端可以,但如果你坚持使用 windows 然后安装这个[ https://www.cygwin.com/]这样你就可以发出 unix 命令