简体   繁体   中英

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. 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?

Composer is a dependency management tool for 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 creates an "autoload.php" file that, if included in your project, autoloads all libraries and classes and makes them available for use.

Typically, in a regular PHP project, you'd include the following line to bootstrap your project:

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. All packages go in the directory "vendor" found in root of your project directory.

Laravel, by default, is a Composer project. 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 . 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. You will notice "vendor" directory in the root directory. 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';

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. 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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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