Skip to content

Instantly share code, notes, and snippets.

@irazasyed
Created May 15, 2026 06:59
Show Gist options
  • Select an option

  • Save irazasyed/f03ae9bcd3c27d4284f71e43224245b5 to your computer and use it in GitHub Desktop.

Select an option

Save irazasyed/f03ae9bcd3c27d4284f71e43224245b5 to your computer and use it in GitHub Desktop.
new() — Scaffold a new Laravel application with sensible defaults.
#
# new() — Scaffold a new Laravel application with sensible defaults.
#
# Creates a fresh Laravel project in the current directory, initializes a Git
# repository, creates a matching GitHub repository under your personal account,
# and pushes the initial commit — all in a single command.
#
# Defaults baked in:
# • MySQL as the database driver
# • Pest as the testing framework
# • Laravel Boost for AI-assisted coding
# • NPM for installing and building front-end dependencies
# • Git initialized with an initial commit on the `main` branch
# • GitHub repository created (private by default) and pushed to `origin`
# • No starter kit — plain Laravel scaffold
#
# Usage:
# new <project-name> # Creates a private GitHub repo
# new <project-name> --public # Creates a public GitHub repo
#
# Examples:
# new my-app # → github.com/<you>/my-app (private)
# new client-portal --public # → github.com/<you>/client-portal (public)
#
# Requirements:
# • Laravel installer (`composer global require laravel/installer`)
# • GitHub CLI (`gh`) authenticated via `gh auth login`
# • Git, PHP, and Node/NPM available on PATH
#
# Notes:
# • The repository is created under your personal GitHub account. To target
# an organization, add `--organization=<org-name>` to the `laravel new` call.
# • Visibility is passed through to `gh repo create` via the `--github=`
# value, so adjustments to GitHub CLI behavior apply here too.
#
new() {
if [[ -z "$1" ]]; then
echo "Usage: new <project-name> [--public]" >&2
return 1
fi
local name="$1"
local github="--github=--private"
[[ "$2" == "--public" ]] && github="--github=--public"
laravel new "$name" \
--database=mysql \
--pest \
--boost \
--npm \
--git \
"$github"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment