search
HomeDevelopment ToolscomposerClass library manager composer installs and configures laravel

When doing projects using the laravel framework, sometimes my mind goes blank and I don’t know how to start, or I encounter many small problems when installing laravel and I don’t know how to solve them. Below I have compiled the notes during the installation process. Hope this can provide support for developers who encounter problems.

1. Download and installation of composer

composerDownload

English website: https://getcomposer.org/

Chinese image: http://www.phpcomposer.com/

1. Tutorial on installing composer under windows:

Chinese image

Class library manager composer installs and configures laravel

Class library manager composer installs and configures laravel

Class library manager composer installs and configures laravel

No need to modify this configuration

Class library manager composer installs and configures laravel

You need to pay attention here before installing this composer A PHP environment is required

Class library manager composer installs and configures laravel

#The above step can be directly installed. After completion, use the composer -v of the cmd command to detect it.

2. Tutorial on installing composer under mac system:

Download Composer directly in command line mode under mac

Use curl command to download:

curl -sS https://getcomposer.org/installer | php

Or if curl is not installed, you can also use the php command to download:

php -r "readfile('https://getcomposer.org/installer');" | php

Manually download Composer

Address: https://getcomposer.org/composer.phar

After you download composer.phar, you can place it in the directory, but every time you create a new directory, you must make a copy to the new directory, which is more troublesome. So the best way is to put it in usr/local/bin and make it a global command.

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

This way you can use the composer command directly in the terminal

2. Laravel installation

composer installs Laravel

1. Download and install directly (need to bypass the wall)

Create a Laravel project named laravel

composer create-project laravel/laravel --prefer-dist

Create a Laravel project named blog

composer create-project laravel/laravel blog -prefer-dist

2. Use the composer image to install (do not circumvent the wall)

Use the Composer image to install the latest version of Laravel

There are two ways to enable the mirror service:

System global configuration: add the configuration information to composer's global configuration file config.json,

Individual project configuration: add the configuration information to a certain In the composer.json file of each project

Example 1: Modify the global configuration file of composer (recommended method)

Open the command line window (windows users) or console (Linux. Mac users) And execute the following command:

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

After the execution of the above command is completed, you can execute the following command again without going over the wall.

Create a Laravel project named laravel

composer create-project laravel/laravel --prefer-dist

Create a Laravel project named blog

composer create-project laravel/laravel blog -prefer-dist

Example 2: Modify the composer.json configuration file of the current project:

Open the command line window (windows users) or console (Linux, Mac users ), enter the root directory of your project (that is, all directories of the composer.json file), and execute the following command:

composer config repo.packagist composer nttps://packagist. phpcoeposer. com

Step 1: Because it is executed under the current project, create a project file first Folder test

Class library manager composer installs and configures laravel

The second step is to modify the composer file of the current project, so there must be a composer.json file first, so manually simulate a text file without any settings. , just name it composer.json.

Class library manager composer installs and configures laravel

Class library manager composer installs and configures laravelAs prompted above, click "Yes"

Class library manager composer installs and configures laravel

Then execute the following command:

composer config repo.packagist composer nttps://packagist. phpcoeposer. com

Class library manager composer installs and configures laravel

Take a look at the composer.json file. This is a file with some extra content.

Class library manager composer installs and configures laravel

Then you can use the following command without going over the wall. .

Create a Laravel project named laravel

composer create-project laravel/laravel --prefer-dist

Create a Laravel project named blog

composer create-project laravel/laravel blog -prefer-dist

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

composer.json file (as shown in the screenshot above) means that the installation of laravel is specified as the Chinese website URL.

The above steps have been installed successfully by me. Just follow the steps above to install them step by step. If you don’t understand anything, please leave a message. Thank you for your support. Hope this helps everyone.

The above is the detailed content of Class library manager composer installs and configures laravel. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Becoming a Composer: Training, Education, and ExperienceBecoming a Composer: Training, Education, and ExperienceApr 28, 2025 am 12:11 AM

To become a composer, you need to master music theory, harmonization, counterpoint, and be familiar with the tone and performance skills of the instrument. Composers express emotions and stories through music, and the creative process involves the construction and improvement of ideas to works.

Identifying a Composer: The Essential ElementsIdentifying a Composer: The Essential ElementsApr 27, 2025 am 12:27 AM

The key steps to identifying a composer include: 1) analyzing the composer's stylistic characteristics, such as Beethoven's drama and power; 2) understanding the composer's historical background and cultural influence, such as Bach's Baroque style; 3) comprehensively analyzing the melody, harmony, rhythm and structure of the work to avoid misjudgment caused by relying solely on a single element.

Composer: The Future of AI in PHP DevelopmentComposer: The Future of AI in PHP DevelopmentApr 26, 2025 am 12:10 AM

Composer'sfutureinPHPdevelopmentwithAIincludes:1)AI-enhanceddependencymanagementforsuggestinglibraries,2)AI-drivencodegenerationfortailoredboilerplate,and3)predictivemaintenanceforupdatesandpatches,butfaceschallengeslikedataprivacyandAIbias.

The Skills and Qualities of a Composer: An OverviewThe Skills and Qualities of a Composer: An OverviewApr 25, 2025 am 12:03 AM

Becoming a successful composer requires skills such as music theory, instrumental performance and sound design, as well as keen inspiration to capture and constant work modification. Composers use these skills and traits to transform emotions and thoughts into musical works, which resonates with their listeners.

Composer's Qualifications: Assessing ProficiencyComposer's Qualifications: Assessing ProficiencyApr 24, 2025 am 12:15 AM

Composer proficiency can be evaluated in the following four aspects: 1) Understand basic concepts, such as packages, dependencies and version control; 2) Master core functions, including parsing composer.json, solving dependencies, downloading packages and generating autoload files; 3) Proficient in using basic and advanced commands, such as composerinstall, update, require, and dump-autoload; 4) Apply best practices, such as using composer.lock files, optimizing autoload configuration, and regularly cleaning caches.

Composer: Leveraging AI for Automated TasksComposer: Leveraging AI for Automated TasksApr 23, 2025 am 12:03 AM

Use Composer to combine AI to achieve automated tasks. 1. Composer manages dependencies through configuration file, and AI can optimize version selection. 2. In practical applications, AI can be used to automate dependency management, testing and deployment. 3. Performance optimization includes dependency loading and caching strategies. 4. Pay attention to issues such as version conflicts and AI misjudgment. Through these methods, AI can improve work efficiency and intelligence.

Composer with AI: Code Suggestions and InsightsComposer with AI: Code Suggestions and InsightsApr 22, 2025 am 12:05 AM

ComposerwithAI is a tool that uses AI to improve the programming experience. 1) It provides real-time suggestions and bug fixes by analyzing code structure, syntax and pattern. 2) Advanced features include code refactoring, performance optimization and security checking. 3) When using, you can adjust the configuration, provide feedback and combine other tools to solve common problems.

Composer: An Introduction to the PHP Dependency ManagerComposer: An Introduction to the PHP Dependency ManagerApr 21, 2025 am 12:02 AM

Composer is a dependency management tool for PHP, which is used to manage libraries and packages required by projects. 1) It defines dependencies through composer.json file, 2) installs and updates using command line tools, 3) automates the dependency management process, improves development efficiency, 4) supports advanced functions such as dynamically adding dependencies and automatic loading, 5) Ensures consistency of the team environment through composer.lock file.

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.