Using Composer in PHP

Source: Internet
Author: User

Online installation version:

http://www.phpcomposer.com/

This is a domestic composer website.

The THINKPHP5 comes with a Composer.phar component and requires installation if it is not installed

The following commands are all running under the project directory
Windows first adds the PHP path to the system's environment variables

Installation
php -r "copy(‘https://getcomposer.org/installer‘, ‘composer-setup.php‘);"php composer-setup.php

Delete composer-setup.php
New Composer.json Empty file (if not present) the contents of the file are:

{}

Run command

install
New Project Introduction

If it's a new project, not THINKPHP5, then introduce the autoload.php file in your PHP file

Update composer
php composer.phar selfupdate
Modify Source Address

Use domestic source address to increase installation speed of components

php composer.phar config repo.packagist composer https://packagist.phpcomposer.com
Adding components
php composer.phar require aliyuncs/oss-sdk-php

Where aliyuncs/oss-sdk-php is the component name
component names can be searched from https://packagist.org/to

Updating components
php composer.phar update --dry-run  #查看看可升级的组件php composer.phar update
Working with Components

You can introduce components by applying namespaces.

Uninstalling components
php composer.phar remove aliyuncs/oss-sdk-php

Uninstalling the component will unload the other components that are introduced.

Local Installation version:

No way to install or be a wall what to do to download an east-east name:

The following commands are executed:

Composer source is easy to access within, change Source: Php composer.phar config repo.packagist composer https://packagist.phpcomposer.com update Source: PHP Composer.phar Update

After that, thank you: Jozfne share

Using Composer in PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.