Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Examples of installing Composer and Composer installing TP5 under Mac

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the installation of Composer under Mac and Composer installation of TP5 examples, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Install Composer in Mac environment

Mac version: macOS High Sierra 10.13.4

Git version: 2.17.0

PHP version: 7.0.29 (cli) (built: Apr 12 2018 03:15:13) (NTS)

Introduction

Composer is a tool that PHP uses to manage dependency relationships.

You can declare the dependent external libraries (libraries) in your project, and Composer will help you install these dependent library files.

Composer can also manage projects. Generally speaking, Composer is a PHP-based version control and project management tool.

English official website: https://getcomposer.org/

English image: https://packagist.org

Chinese official website: https://www.phpcomposer.com/

Chinese image: https://pkg.phpcomposer.com/

Install Composer

You only need to do two things to install Composer

1. Download and install composer.phar

2. Configure Chinese image

Details are as follows:

1. Install globally and download the latest version of composer.phar on the official website.

2. Verification, executed in the file directory

Ensure that PHP is available and that version b is greater than 5.6

Php-v

The composer version number and date are the same as the official website.

Php composer.phar-v

3. Finally, set it to a global command

Mv composer.phar / usr/local/bin/composer

Installation is complete at this point

4. Next, configure the Chinese image

Global replacement:

Composer config-g repo.packagist composer https://packagist.phpcomposer.com

Local configuration: (valid for current directory only)

Composer config repo.packagist composer https://packagist.phpcomposer.com

The above command will automatically add the configuration information of the image at the end of the composer.json file in the current project (you can also add it manually):

"repositories": {"packagist": {"type": "composer", "url": "https://packagist.phpcomposer.com"}}"

Take the MongoDB extension as an example, add the composer.json file to the current directory, as follows

{"require": {"monolog/monolog": "1.2.*"}}

After executing the above order, it becomes

{"require": {"monolog/monolog": "1.2.*"}, "repositories": {"packaglist": {"type": "composer", "url": "https://packagist.phpcomposer.com"}"

Then execute composer install to install MongoDB

Composer install TP5

There is no need to create a composer.json for direct installation, just execute the following command.

Composer create-project topthink/think tp5-prefer-dist Thank you for reading this article carefully. I hope the article "installing Composer under Mac and installing TP5 in Composer" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report