search
HomeDevelopment ToolscomposerTeach you how to manually install composer under windows

The following tutorial column will introduce to you how to manually install composer under windows. I hope it will be useful to friends who need it. Helped!

composer is a PHP dependency management tool. Installation under Windows is often blocked. Now we provide a manual The installation method is for reference onlyTeach you how to manually install composer under windows1. Preparation before installation

(1)Composer requires PHP 5.3.2 to run

(2) Add the path variable to the php running directory.

That is to ensure that you can directly run php -v when opening cmd anywhere (3) Make sure that php opens the openssl extension

Search for OpenSSL in php.ini and remove the previous Semicolon, save and restart the server.

2. Install and configure composer

(1) Download composer.phar

https://getcomposer.org/composer.phar 下载到本地  (例如F:\tools\composer)

cmd and run

cd F:\tools\composer
F:
php composer.phar -v
(2) Add the directory where composer.phar is located to the path environment variable (3) Create a composer shortcut command

##

cd F:\tools\composer
F:
echo @php "%~dp0composer.phar" %*>composer.bat

is in F:\tools\composer has created a composer.bat batch file, and F:\tools\composer has been added to the environment variable. In the future, entering composer anywhere will be equivalent to

php
 composer.phar
(4) Modify the image Japanese image address

http://composer-proxy.jp/proxy/packagist
can be set globally You can also set it as needed

In order to avoid performing two queries when installing the package, remember to add disable Packagist settings

Global settings

查看 composer 主目录:通过 composer config -l -g 命令可以列出 composer 的全局配置信息,在这些信息中查找[home] 配置项就是 composer 的主目录。

进入 composer 的主目录,打开 config.json 文件(如果没有就自己创建一个),然后增加本镜像服务的配置信息,最终内容如下:

{
    "config": {
    },
    "repositories": [
        {"type": "composer", "url": "http://composer-proxy.jp/proxy/packagist"},
        {"packagist": false}
    ]
}

按需设置

如果只需要特定的项目指定特定的镜像,则不需修改全局设置,在需要的地方进行修改

以 laravel 项目的 composer.json 配置文件为例,添加本镜像服务配置信息后如下所示(注意最后几行):

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "laravel/framework": "5.0.*"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }    },
    "autoload-dev": {
        "classmap": [            "tests/TestCase.php"
        ]    },
    "config": {
        "preferred-install": "dist"
    }    "repositories": [
        {"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"},
        {"packagist": false}
    ]}

The above is the detailed content of Teach you how to manually install composer under windows. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete
Using Dicr/Yii2-Google to integrate Google API in YII2Using Dicr/Yii2-Google to integrate Google API in YII2Apr 18, 2025 am 11:54 AM

VprocesserazrabotkiveB-enclosed, Мнепришлостольностьсясзадачейтерациигооглапидляпапакробоглесхетсigootrive. LEAVALLYSUMBALLANCEFRIABLANCEFAUMDOPTOMATIFICATION, ČtookazaLovnetakProsto, Kakaožidal.Posenesko

How to use Composer to resolve JSON Schema verification issuesHow to use Composer to resolve JSON Schema verification issuesApr 18, 2025 am 11:51 AM

I'm having a tricky problem when developing a Symfony-based application: how to effectively validate JSON data format. Initially, I tried using manual verification code, but this was not only complicated, but also error-prone. After some exploration, I discovered a Composer package called ptyhard/json-schema-bundle, which brought great convenience and efficiency to my project.

Use Composer to solve the dilemma of recommendation systems: andres-montanez/recommendations-bundleUse Composer to solve the dilemma of recommendation systems: andres-montanez/recommendations-bundleApr 18, 2025 am 11:48 AM

When developing an e-commerce website, I encountered a difficult problem: how to provide users with personalized product recommendations. Initially, I tried some simple recommendation algorithms, but the results were not ideal, and user satisfaction was also affected. In order to improve the accuracy and efficiency of the recommendation system, I decided to adopt a more professional solution. Finally, I installed andres-montanez/recommendations-bundle through Composer, which not only solved my problem, but also greatly improved the performance of the recommendation system. You can learn composer through the following address:

How to quickly build Fecmall advanced project templates using ComposerHow to quickly build Fecmall advanced project templates using ComposerApr 18, 2025 am 11:45 AM

When developing an e-commerce platform, it is crucial to choose the right framework and tools. Recently, when I was trying to build a feature-rich e-commerce website, I encountered a difficult problem: how to quickly build a scalable and fully functional e-commerce platform. I tried multiple solutions and ended up choosing Fecmall's advanced project template (fecmall/fbbcbase-app-advanced). By using Composer, this process becomes very simple and efficient. Composer can be learned through the following address: Learning address

Improve Doctrine entity serialization efficiency: application of sidus/doctrine-serializer-bundleImprove Doctrine entity serialization efficiency: application of sidus/doctrine-serializer-bundleApr 18, 2025 am 11:42 AM

I had a tough problem when working on a project with a large number of Doctrine entities: Every time the entity is serialized and deserialized, the performance becomes very inefficient, resulting in a significant increase in system response time. I've tried multiple optimization methods, but it doesn't work well. Fortunately, by using sidus/doctrine-serializer-bundle, I successfully solved this problem, significantly improving the performance of the project.

Use Composer to resolve error logging issues in Laravel projectsUse Composer to resolve error logging issues in Laravel projectsApr 18, 2025 am 11:39 AM

When developing Laravel projects, the management of error logs is a very critical link. Recently, I encountered a problem in my project: how to efficiently capture and record all types of errors and ensure that these error messages can be processed in a timely manner. After some research, I found the lukeboy25/errorlogger package. It is installed through Composer and can greatly simplify the management process of error logs. You can learn composer through the following address:

How to use Composer to improve the security of Laravel applications: Applications of wiebenieuwenhuis/laravel-2fa libraryHow to use Composer to improve the security of Laravel applications: Applications of wiebenieuwenhuis/laravel-2fa libraryApr 18, 2025 am 11:36 AM

When developing a Laravel application, I encountered a common but difficult problem: how to improve the security of user accounts. With the increasing complexity of cyber attacks, a single password protection is no longer enough to ensure the security of users' data. I tried several methods, but the results were not satisfactory. Finally, I installed the wiebenieuwenhuis/laravel-2fa library through Composer and successfully added two-factor authentication (2FA) to my application, greatly improving security.

Use Composer to simplify mobile device detection and file download size calculationsUse Composer to simplify mobile device detection and file download size calculationsApr 18, 2025 am 11:33 AM

When developing a website, I encountered a common but difficult problem: how to accurately determine the type of user access device and how to quickly get the download size of a file. These features may seem simple, but they need to deal with a lot of details and compatibility issues when implemented. After some exploration, I discovered the Composer package weizhang/utilities, which provides a simple and effective solution.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor