Skip to content

Instantly share code, notes, and snippets.

@vkabc
Forked from senkawa/brew.md
Last active August 19, 2024 02:37
Show Gist options
  • Save vkabc/b0805966d8ef86677767670e5dd256dd to your computer and use it in GitHub Desktop.
Save vkabc/b0805966d8ef86677767670e5dd256dd to your computer and use it in GitHub Desktop.
laravel install, again

First, uninstall any PHP/apache deps you might have previously installed. Do a brew list and look for any matching packages.

brew tap shivammathur/php
brew install shivammathur/php/php@8.2
brew link --force --overwrite shivammathur/php/php@8.2

brew tap shivammathur/extensions
brew install igbinary@8.2 msgpack@8.2 redis@8.2 xdebug@8.2

I recommend using a tool like fnm to manage your node versions, but if you don't really care: purge your existing nodejs installation (if any) and brew install node.

Tutorials: https://laracasts.com/series/laravel-8-from-scratch

Example project creation to mess around with Laravel: https://laravel.com/docs/8.x/installation#installation-via-composer

FAQs

You're free to use any IDE, vscode and phpstorm are good options. vscode has extensions specific for PHP + Laravel.

  • Composer is PHP's package manager, you'll need it to install dependencies.
  • Node is required and used for frontend asset compilation only.
  • There is no Apache or separate server to run. PHP (the cli tool, php) has a built in server. See https://www.php.net/manual/en/features.commandline.webserver.php for more info.
  • Artisan is the main "cli" tool for Laravel. Run php artisan for a list of commands.
  • To start the web server: php artisan serve

Setup pgsql for dev environment

#override with trust
vim /opt/homebrew/var/postgresql@14/pg_hba.conf 

First, uninstall any PHP/apache deps you might have previously installed. Do a brew list and look for any matching packages.

Switch to root first.

sudo su
apt-get update \
    && apt-get install -y gnupg gosu curl ca-certificates zip unzip git sqlite3 libcap2-bin libpng-dev

add-apt-repository -y ppa:ondrej/php

apt update \
    && apt install -y php8.3-cli php8.3-dev \
       php8.3-pgsql php8.3-sqlite3 php8.3-gd \
       php8.3-curl \
       php8.3-imap php8.3-mysql php8.3-mbstring \
       php8.3-xml php8.3-zip php8.3-bcmath \
       php8.3-intl php8.3-readline \
       php8.3-msgpack php8.3-igbinary php8.3-redis \
       php8.3-pcov php8.3-xdebug php8.3-fpm

php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer

I recommend using a tool like fnm to manage your node versions, but if you don't really care: purge your existing nodejs installation (if any) and run the following.

curl -sL https://deb.nodesource.com/setup_20.x | bash - \
    && apt install -y nodejs

If you've skipped this step, just make sure your node version is 20.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment