{"id":19291890,"url":"https://github.com/hasanuzzamanbe/php-environment-setup-for-mac","last_synced_at":"2025-07-19T14:32:11.026Z","repository":{"id":129749570,"uuid":"536228947","full_name":"hasanuzzamanbe/php-environment-setup-for-mac","owner":"hasanuzzamanbe","description":"PHP environment setup sometime ruins our day. So here is the easiest way to setup Laravel valet on your Mac machine to run PHP or WordPress.","archived":false,"fork":false,"pushed_at":"2022-09-13T17:55:15.000Z","size":335,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T00:17:25.513Z","etag":null,"topics":["laravel","laravel-valet","laravel-valet-setup","mac-setup","php","php-environment","wordpress-setup"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hasanuzzamanbe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-13T17:06:33.000Z","updated_at":"2024-12-26T05:17:19.000Z","dependencies_parsed_at":"2023-05-20T21:15:23.515Z","dependency_job_id":null,"html_url":"https://github.com/hasanuzzamanbe/php-environment-setup-for-mac","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hasanuzzamanbe/php-environment-setup-for-mac","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasanuzzamanbe%2Fphp-environment-setup-for-mac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasanuzzamanbe%2Fphp-environment-setup-for-mac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasanuzzamanbe%2Fphp-environment-setup-for-mac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasanuzzamanbe%2Fphp-environment-setup-for-mac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hasanuzzamanbe","download_url":"https://codeload.github.com/hasanuzzamanbe/php-environment-setup-for-mac/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasanuzzamanbe%2Fphp-environment-setup-for-mac/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265947490,"owners_count":23853382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-valet","laravel-valet-setup","mac-setup","php","php-environment","wordpress-setup"],"created_at":"2024-11-09T22:28:22.945Z","updated_at":"2025-07-19T14:32:10.991Z","avatar_url":"https://github.com/hasanuzzamanbe.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-environment-setup-for-mac\nPHP environment setup sometime ruins our day. So here is the easiest way to setup Laravel valet on your Mac machine to run PHP or WordPress.\nYou can follow the guideline bellow or\n\u003e you may read the web version from\n[https://wpminers.com/how-to-install-laravel-valet-on-mac](https://www.wpminers.com/how-to-install-laravel-valet-on-mac)\n\n\n# SETTING UP A PHP / WORDPRESS DEVELOPMENT ENVIRONMENT TAKES TEN MINUTES.\n\nYou must set up a local server if you have a Mac and want to run PHP or create a local development environment for WordPress. Sometimes, setting that up can destroy our day.\n\nBut we can make it easy by doing some tricks. I will show you how to set up a local environment for PHP, Laravel, or WordPress within 5-10 minutes.\n\nYou can run your servers using several apps such as xammp, mamp, and wamp. However, we will make use of Laravel Valet.\n\n## What is Laravel Valet?\n\nLaravel Valet is a development environment for macOS minimalists. Laravel Valet configures your Mac always to run Nginx in the background when your machine starts.\n\nTo set up the valet server, you must first set up Homebrew.\n\n## What is Homebrew?\n\nHomebrew is a package management application for the Mac. “It’s more like the npm (node package manager) you use to continually update and install or remove your node packages,” for example. Homebrew serves the same purpose as npm on Mac and Linux.\n\nTo set up a Mac development environment, we have to install several applications on our device.\n\n\u003e We will install by following steps:\n1. Homebrew Installation\n\n2. PHP \u0026 MySQL Installation\n\n3. Composer Installation\n\n4. Laravel valet install\n\n# SETUP STARTED:\n## 1. INSTALLING HOMEBREW ON MAC:\nOpen your macOS terminal and run this command bellow\n\n\u003e `/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"`\n\nUse this command to check the Homebrew version. If all goes well, you could see like this.\n\n[\u003cimg alt=\"brew-setup-done\" src=\"assets/brew.png\"/\u003e](https://github.com/csesumonpro/Github-Readme-Cheatsheet)\n\nIf it throws any exception, your global path may need to be set up; just follow the instructions on the terminal.\n\n\u003e `brew -v`\n\nHomebrew version check on terminal\n\n## 2. INSTALLING PHP AND MYSQL:\nYou must have to install PHP if your device has not any. It will be simple using brew command. Run this command on your terminal.\n\n\u003e `brew install php`\n\nThen, if you wish to store your data, you must install MySQL. It is also essential if you want to run WordPress locally.\n\nRun command to install MySQL\n\n\u003e `brew install mysql`\n\nAfter successfully installing PHP and MySQL, you must run those services. You can run any services using Homebrew with a single command like “brew services start YourServiceName”\n\nFor example, you can run MySQL by\n\u003e `brew services start mysql`\n\nAnd to run PHP using:\n\u003e `brew services start php`\n\nRecommend:\n\n To run all services like PHP and MySQL by a single command.\n\n\u003e `brew services restart --all`\n\nThis success message will be displayed to let you know whether your service is up and running.\n\nRestarting all services by Homebrew\nRestarting all services by Homebrew\nAfter installing PHP, you are ready to install the Composer package manager\n\n## 3. INSTALLING COMPOSER\nComposer is also a package manager of PHP like npm or brew. And it is also very easy to install using the brew command.\n\nRun this command below:\n\nbrew install composer\nTo check the successful installation, you can check the version by the command\n\n\u003e `composer -v`\n\nAnd it will show like this with the current version number.\n\n[\u003cimg alt=\"brew-setup-done\" src=\"assets/composer.png\"/\u003e](https://github.com/csesumonpro/Github-Readme-Cheatsheet)\n\nComposer installed globally\nComposer installed globally\nExceptions:\n\nSometimes it may throw some exceptions cause your composer is not on the global path. To make this happen, you may have to run this command below:\n\n\u003e `sudo mv composer.phar /usr/local/bin/composer`\nThen check again by the version is available or not. If you see the version, then your composer setup is done.\n\n## 4. INSTALLING LARAVEL VALET USING COMPOSER\nUsing composer, you can easily install Laravel Valet. Run the command below\n\n\u003e `composer global require laravel/valet`\n\nAfter that, you are ready to install valet on your machine.\n\n\u003e `valet install`\n## Exception:\n\u003chr\u003e\n\n    Sometimes you may face this issue Laravel “valet install” not found!”\n\n    you need to make sure that ~/.composer/vendor/bin directory is in your system’s PATH; you can check this by running `echo $PATH`  To solve this issue, run this command below.\n\n\u003e `export PATH=$PATH:~/.composer/vendor/bin`\n\n\u003ci\u003eThen run again:\u003c/i\u003e\n\n\u003e `valet install`\n\n\u003chr\u003e\n\nAnd You are done installing all packages. Now you can use your server; open the directory in your terminal that you want to run with the server. Go to the project directory, Then run this command on the terminal. Laravel valet server is parked. You might be prompted to enter your Mac password; simply input it and press Enter. Then it will appear as follows: You parked your project directory.\n\nFollowing the execution of the command,\n\n\u003e `valet park`\n\nwill validate that your directory has been added to the valet’s path. It appears to be like the image below.\n\n[\u003cimg alt=\"brew-setup-done\" src=\"assets/valet.png\"/\u003e](https://github.com/csesumonpro/Github-Readme-Cheatsheet)\n\nThis command will park your project on the server\n\n# How to run projects on your server:\n\nIt’s very easy and no need to run every day. It will run automatically for you. Run your project in any browser on your Mac in this manner.\n\nhttp://Your-project-name.test\n\nJust one thing you have to ensure your projects is in the parked directory. If not, then just add it using the same command: valet park\n\nExample:\n\nHere is my directory, which contains a project called “Welcome” that is already in the parking directory. You can get to it by typing welcome.test into your local browser.\n\n[\u003cimg alt=\"brew-setup-done\" src=\"assets/directory.png\"/\u003e](https://github.com/csesumonpro/Github-Readme-Cheatsheet)\n\nProject directory for valet server\nProject directory\nAccess valet server\nEven if You can make this test domain secure by a single command, open your project on the terminal and run this command below, then It will run under SSL now.\n\n\u003e `valet secure`\n\nMaking projects secure under SSL you can run like this https://Your-project-name.test\nYour server configuration is complete. You can run your PHP , Laravel application using this server. Also, you can run your WordPress locally. If you face any problems, please leave a remark below.\n\nIf you face any issue you may comment on the [Blog](https://wpminers.com/how-to-install-laravel-valet-on-mac) or create an issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasanuzzamanbe%2Fphp-environment-setup-for-mac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhasanuzzamanbe%2Fphp-environment-setup-for-mac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasanuzzamanbe%2Fphp-environment-setup-for-mac/lists"}