Skip to content

Instantly share code, notes, and snippets.

@saleh-old
Last active April 12, 2019 15:21
Show Gist options
  • Save saleh-old/ee889640ac497703ba5d02c78c2f6eae to your computer and use it in GitHub Desktop.
Save saleh-old/ee889640ac497703ba5d02c78c2f6eae to your computer and use it in GitHub Desktop.
# of course, skip steps that you already have done before
# update homebrew
brew update
# install php 7.3 (although +7.1 would do)
brew install php@7.3
# make sure php version is 7.3. On a new terminal tab run:
php -v
# install MySQL 5.7 (MySQL v8 seems to not work smoothly with PHP so far)
brew install mysql@5.7
brew services start mysql@5.7
# connect to MySQL via your favorite database manager app. Mine is the free version of https://tableplus.io.
# notice that with default installation of MySQL username is 'root' and password is empty ''.
# connect and create a database by pressing 'command + K' and clicking on '+' button. Name it 'votendb'.
# install Redis
brew install redis
brew services start redis
# install composer globally(my personal preference)
# it is recommended to execute the latest installation commands from below link:
https://getcomposer.org/download/
# to make it executable globally, move it to your /local/bin folder:
mv composer.phar /usr/local/bin/composer
# To make sure composer works globally, open a new terminal tab and run:
composer -V
# from laravel docs: https://laravel.com/docs/5.8/valet
# Laravel Valet configures your Mac to always run Nginx in the background when your machine starts.
# Then, using DnsMasq, Valet proxies all requests on the *.test domain to point to sites installed on your local machine.
# to install Laravel Valet, run:
valet install
# if you get "command not found: valet", it means composer's bin folder is not added to your PATH. To fix it, first check your PATH:
echo $PATH
# if you don't see '~/.composer/vendor/bin' in it, add it:
# if you are using ZSH, open '~/.zshrc'. If not, '~/.bash_profile'. I'm using zsh, so (notice I'm using VSCode, you can use nano, vm, etc):
code ~/.zshrc
# and add the following line at the end of it:
export PATH=~/.composer/vendor/bin:$PATH
# now open a new terminal tab and run:
valet --verison
# if it's all good, it should ask for your root password, enter it and you should now see version of the installed Laravel Valet.
# now try again:
valet install
# to make sure valet is working, try pinging:
ping voten.test
# If Valet is installed correctly you should see this domain responding on 127.0.0.1.
# choose or create a directoy as your /public directory. (like the www/public directoy on your server)
# for example, I create one:
mkdir ~/Codes/sites
# and then set it as parking of your sites for Valet:
cd ~/Codes/sites
valet park
# clone Voten repository into our parking:
git clone https://github.com/voten-co/voten.git
# copy .env file:
cp .env.example .env
# open .env file with your favorite edit, mine is vscode, so:
code .env
# replace these lines with:
# APP_URL=http://voten.test
# DB_DATABASE=votendb
# DB_USERNAME=root
# DB_PASSWORD=
# SCOUT_DRIVER=null
# install php packages:
composer install
# generate key for your Laravel app(as is Voten):
php artisan key:generate
# run database migration
php artisan migrate
# to make authentication work:
php artisan passport:install
# install node packages:
npm install
# compile front-end files:
npm run dev
# create the initial admin user by running:
php artisan db:seed --class=AdminUserSeeder
# you can now open http://voten.test with Chrome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment