简体   繁体   English

如何在Laravel 4中手动安装Laravel Cashier

[英]How to manually install Laravel Cashier in Laravel 4

I already know how to install by going through composer.json to add laravel/cashier, then composer update, and then add some line in app provider. 我已经知道如何安装,方法是通过composer.json添加laravel / cashier,然后更新composer,然后在应用程序提供商中添加一些代码。 But where does this folder go? 但是此文件夹在哪里? What other things does it add in my app to make it fully functional? 它在我的应用程序中添加了哪些其他功能以使其完全起作用? What is the work flow of composer update in Laravel 4? Laravel 4中作曲家更新的工作流程是什么?

Composer is a dependency management tool for PHP. Composer是PHP的依赖项管理工具。 It is not a typical package manager as it does not install libraries globally, but on a per project basis. 它不是典型的程序包管理器,因为它不会全局安装库,而是根据每个项目安装。 It uses the file "composer.json" to install, update and remove libraries specified, including the version requested. 它使用文件“ composer.json”来安装,更新和删除指定的库,包括请求的版本。

Composer creates an "autoload.php" file that, if included in your project, autoloads all libraries and classes and makes them available for use. Composer创建一个“ autoload.php”文件,如果该文件包含在您的项目中,则会自动加载所有库和类并使它们可供使用。

Typically, in a regular PHP project, you'd include the following line to bootstrap your project: 通常,在常规的PHP项目中,您将包含以下行以引导您的项目:

require 'vendor/autoload.php';

Now, when you execute composer install (for first time) or composer update (every time after), Composer adds/removes packages according to configuration made in "composer.json" file. 现在,当您执行composer install (首次)或composer update (每次之后)时,Composer会根据“ composer.json”文件中的配置添加/删除软件包。 All packages go in the directory "vendor" found in root of your project directory. 所有软件包都位于项目目录根目录下的“供应商”目录中。

Laravel, by default, is a Composer project. Laravel默认情况下是Composer项目。 You know when you execute composer create-project laravel/laravel my-app --prefer-dist to install Laravel, you are telling Composer to build a "composer.json" file with Laravel project and its dependencies, and run composer install . 您知道当执行composer create-project laravel/laravel my-app --prefer-dist安装Laravel时,您是在告诉Composer使用Laravel项目及其依赖项构建“ composer.json”文件,然后运行composer install That's all! 就这样!

Last but not least, Laravel, since it is a Composer project, includes "autoload.php" file and autoloads all packages within that project by default. 最后但并非最不重要的一点是,由于Laravel是Composer项目,因此默认情况下包括“ autoload.php”文件并自动加载该项目中的所有软件包。 You will notice "vendor" directory in the root directory. 您会在根目录中注意到“ vendor”目录。 In Laravel 5 project, if you navigate to "bootstrap/autoload.php" file, you will see Laravel includes "autoload.php" file: require __DIR__.'/../vendor/autoload.php'; 在Laravel 5项目中,如果导航到“ bootstrap / autoload.php”文件,则会看到Laravel包含“ autoload.php”文件: require __DIR__.'/../vendor/autoload.php';

To answer your question about manually installing Laravel Cashier, Laravel Cashier is a package made specifically for Laravel, and as such, is not meant to be used on regular PHP project, unless you use specific classes and do some tweaking. 为了回答有关手动安装Laravel Cashier的问题,Laravel Cashier是专门为Laravel开发的软件包,因此,除非您使用特定的类并进行一些调整,否则它并不打算在常规PHP项目中使用。 To manually install Laravel Cashier, if you go to the following link, you will find link to "laravel/cashier" GitHub repository, from where you can manually download Zip file or clone the repository using git: 要手动安装Laravel Cashier,如果您转到以下链接,则会找到指向“ laravel / cashier” GitHub存储库的链接,您可以从此处手动下载Zip文件或使用git克隆存储库:

https://packagist.org/packages/laravel/cashier

I hope this adequately answers your questions - I kept it as simple as I could. 我希望这能充分回答您的问题-我尽量保持简单。 Let me know if you have any other questions. 如果您还有其他问题,请告诉我。

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

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