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

How to install php dependency package with docker's composer

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the relevant knowledge of "how to install the php dependency package with docker's composer". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

When composer is not installed on the machine, you can run it with docker: docker run

How can you run it in any directory? bash can define function:

Create a directory on the host to hold the configuration and cache files for composer:

Mkdir ~ / dnmp/composer

Open the host ~ / .bashrc or ~ / .zshrc file, and add:

Composer () {

Tty=

Tty-s & & tty=--tty

Docker run\

$tty\

-- interactive\

-- rm\

-- user $(id-u): $(id-g)\

-volume ~ / dnmp/composer:/tmp\

-- volume / etc/passwd:/etc/passwd:ro\

-- volume / etc/group:/etc/group:ro\

-volume $(pwd): / app\

Composer "$@"

}

Make the file work:

Source / .bashrc

Composer can be used in any directory on the host:

Cd ~ / dnmp/www/

Composer create-project yeszao/fastphp project-no-dev

(optional) if prompted for dependency, turn off dependency detection with-- ignore-platform-reqs-- no-scripts.

(optional) the first time you use composer, a config.json file is generated in the ~ / dnmp/composer directory, in which you can specify a domestic warehouse, for example:

{

"config": {}

"repositories": {

"packagist": {

"type": "composer"

"url": "https://packagist.laravel-china.org""

}

}

}

This is the end of "how to install the php dependency package with docker's composer". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Servers

Wechat

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

12
Report