search
HomeDevelopment ToolscomposerHow to install (mac/linux) laravel with composer

How does composer install (mac/linux) laravel? The following is a detailed introduction from the composer tutorial column~

1. Introduction

  1. composer is used for management by PHP Dependency tools. You can declare the external libraries (libraries) you depend on in your project, and composer will install these dependent library files for you.
  2. composer official website address is: https://getcomposer.org/
  3. composer official website download and installation address: https://getcomposer.org/downl...
  4. Installation There are two ways, one is to download the composer.phar file directly from the official website and install it; the other is to download and install it directly through the command line. Here we mainly introduce the command line installation~

2. Command line installation of composer

  1. Use the php -r command to execute a piece of php code to download the composer-setup.php file
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

    Remarks: Execute the above command Afterwards, you will find that there is a composer-setup.php file in the current directory
    How to install (mac/linux) laravel with composer

  2. Verification, execute the following command:

    php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

    Note: If the verification passes after executing the above command, Installer verified will be outputHow to install (mac/linux) laravel with composer

  3. ##The php file downloaded by executing the above steps

    php composer-setup.php

    Remarks: A composer.phar file will be generated directly after execution How to install (mac/linux) laravel with composer

  4. Delete the composer-setup.php file:

    php -r "unlink('composer-setup.php');"
  5. composer.phar in Linux is an executable program. For example, we can use php composer.phar update to perform update operations. At this point, our composer tool is completely installed. You can use it to install various dependent library files of PHP~
  6. If you want to use composer globally to install dependent libraries, you can execute the following command Global installation:

    mv composer.phar /usr/local/bin/composer

    Note: After that, you can directly use composer install to install various packages and dependencies. However, usually you only need to add the location of composer.phar to PATH, and it does not have to be installed globally.

3. For installation in other environments, please refer to:

http://www.thinkphp.cn/topic/...

http://laravelacademy. org/pos...

4. Domestic image configuration

Because composer loads foreign images by default, due to the existence of the "wall" in China, errors will occur when loading foreign images, so configuration is required Domestic mirroring.

To configure the domestic image, execute the following command:

composer config -g repo.packagist composer https://packagist.phpcomposer.com
5. Use composer to install Laravel

    The first four major steps are to basically install and configure composer successfully, and then proceed Use the composer tool to install the Laravel framework
  1. Create your own laravel project in your own site directory, for example, name it wxd, and execute the following command:

    composer create-project --prefer-dist laravel/laravel wxd
    备注:如果想要制定版本可以使用如下命令:
    composer create-project --prefer-dist laravel/laravel wxd "5.2.*"
  2. After executing the command, wait for a while for the installation to be successful:

  3. How to install (mac/linux) laravel with composer
  4. After the installation is successful, enter the project and you can see the various directories of the framework, including composer.json:

  5. How to install (mac/linux) laravel with composer

The above is the detailed content of How to install (mac/linux) laravel with composer. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:segmentfault. If there is any infringement, please contact admin@php.cn delete
Composer: Streamlining PHP Project DevelopmentComposer: Streamlining PHP Project DevelopmentApr 15, 2025 am 12:08 AM

Composer simplifies PHP project development steps include: 1) adding dependencies, such as adding "laravel/framework":"^8.0" in composer.json; 2) automatically loading, generating an autoload.php file by defining the namespace and classpath; 3) optimizing performance, using composerdump-autoload-o and composerinstall--no-dev-optimize-autoloader commands. Through these steps, developers can be more efficient and avoid common mistakes.

Composer Credentials: What Makes Someone a Composer?Composer Credentials: What Makes Someone a Composer?Apr 14, 2025 am 12:13 AM

The key elements of becoming a composer include: 1. Mastering music theory, 2. Being creative and original, 3. Having technical skills, 4. Being able to express emotions and tell stories, 5. Understand cultural and historical background, 6. Accumulating practice and experience, these elements together constitute the composer's identity and ability.

The Path to Becoming a Composer: A Practical GuideThe Path to Becoming a Composer: A Practical GuideApr 13, 2025 am 12:11 AM

The steps to becoming a composer include: 1. Master the basic elements of music, such as notes, rhythm, harmony, and melody; 2. Select appropriate technical tools, such as AbletonLive; 3. Understand the process of composing, including inspiration acquisition, conception, writing, modification and improvement; 4. Start with simple melody creation and gradually try complex techniques such as harmony; 5. Solve common problems through debugging techniques, such as note selection and rhythm arrangement; 6. Apply performance optimization and best practices, such as using templates, version control, and collaboration.

Composer: The Key to Building Robust PHP ApplicationsComposer: The Key to Building Robust PHP ApplicationsApr 12, 2025 am 12:05 AM

Composer is a key tool for building robust PHP applications because it simplifies dependency management, improves development efficiency and code quality. 1) Composer defines project dependencies through composer.json file and automatically downloads and manages these dependencies. 2) It generates a composer.lock file to ensure that the dependency version is consistent and automatically loaded through vendor/autoload.php. 3) Examples of usage include basic usage such as adding log libraries, as well as advanced usage such as version constraints and environment variable management. 4) Common error debugging techniques include handling dependency conflicts and network problems. 5) Performance optimization suggestions include using composer.lock file and optimizing automatic loading.

Composer Expertise: What Makes Someone SkilledComposer Expertise: What Makes Someone SkilledApr 11, 2025 pm 12:41 PM

To become proficient when using Composer, you need to master the following skills: 1. Proficient in using composer.json and composer.lock files, 2. Understand how Composer works, 3. Master Composer's command line tools, 4. Understand basic and advanced usage, 5. Familiar with common errors and debugging techniques, 6. Optimize usage and follow best practices.

What is a composer doing?What is a composer doing?Apr 08, 2025 am 12:19 AM

Composer is a dependency management tool for PHP, used to declare, download and manage project dependencies. 1) Declare dependencies through composer.json file, 2) Install dependencies using composerinstall command, 3) parse the dependency tree and download it from Packagist, 4) generate the autoload.php file to simplify automatic loading, 5) optimize use includes using composerupdate--prefer-dist and adjusting the autoload configuration.

What is App composer?What is App composer?Apr 07, 2025 am 12:07 AM

AppComposer is a tool for building and managing applications. 1) It simplifies application development and improves efficiency by dragging and configuring predefined components. 2) Developers can define components, combine interfaces, define business logic, and ultimately render the application. 3) Support basic and advanced usage, such as task management and conditional rendering, helping to build flexible applications.

What is a composer used for?What is a composer used for?Apr 06, 2025 am 12:02 AM

Composer is a dependency management tool for PHP. The core steps of using Composer include: 1) Declare dependencies in composer.json, such as "stripe/stripe-php":"^7.0"; 2) Run composerinstall to download and configure dependencies; 3) Manage versions and autoloads through composer.lock and autoload.php. Composer simplifies dependency management and improves project efficiency and maintainability.

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)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

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.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment