Home > PHP Framework > Laravel > body text

Install laravel on mac

WBOY
Release: 2023-05-29 09:04:07
Original
881 people have browsed it

Laravel is an excellent PHP framework that is widely used in web development. Installing Laravel on Mac requires some basic command line tools, as well as support from software such as PHP and Composer. This article will guide you step by step to install Laravel on Mac.

Installing Homebrew

First, we need to install a Mac package manager-Homebrew, which allows us to install and manage various applications more conveniently.

Execute the following command in the terminal to install Homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Copy after login

After the installation is completed, we can use the brew command to install various software packages, such as PHP, Composer, etc.

Install PHP and Composer

Laravel runs based on PHP, so we need to install PHP and Composer on Mac. Execute the following command in the terminal to install:

brew install php
Copy after login
brew install composer
Copy after login

After the installation is completed, we can use the php -v and composer -v commands to verify whether the installation is successful.

Installing Laravel

Before installing Laravel, we also need to install some extension packages and command line tools.

  1. Install the extension package
brew install imagemagick
Copy after login
brew install php-intl
Copy after login
  1. Install the command line tool
composer global require laravel/installer
Copy after login

After the installation is complete, we can use laravel Commands to create and manage Laravel projects.

Create Laravel Project

Execute the following command to create a new Laravel project:

laravel new myproject
Copy after login

This will create a project named myproject in the current directory new project. When executing this command, Laravel's core code and dependency packages will be automatically downloaded, and some default file and directory structures will be created for us.

Run the Laravel project

Execute the following command to start the Laravel development server:

cd myproject
Copy after login
php artisan serve
Copy after login

By default, Laravel will run at http://localhost:8000 Start the development server.

Now we can visit http://localhost:8000 in the browser to view Laravel’s default welcome page!

Summary

The above are all the steps to install Laravel on Mac. It should be noted that you may encounter various dependencies and environmental problems during the installation process, and you need to make adjustments and adjustments according to the error prompts. solve. I hope this article can help developers who want to use Laravel on Mac.

The above is the detailed content of Install laravel on mac. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template