This is a modern, strict, strongly typed Laravel application skeleton that can be used to start new projects.
You should ensure that you have the following installed on your host machine:
- Git
- Docker
- Docker-compose
- pnpm v8
That's it!
We use pnpm's use-node-version
in .npmrc
to manage the node version to use in the project, which means that you don't need a locally installed Node. This way we can ensure that all developers are using the same version of Node.
PHP and webserver:
- Dockerized Laravel Octane with FrankenPHP for lightning fast response times and HTTPS local development environment
- PHP 8.3
Back end:
- Laravel 11
- PHPStan (& Larastan) set to the highest level, as well as phpstan/phpstan-strict-rules for extra strictness
- PHPUnit 11
- Rector
- PHP CS Fixer configured to use the latest PER coding standards
- PHP_CodeSniffer configured to use the latest PSR12 coding standards
Front end:
- pnpm
- Node 20 (LTS)
- TypeScript
- Vite 5 (with Laravel plugin)
- Vitest
- Prettier
- ESLint
-
Clone this repo:
git clone git@github.com:philbates35/laravel-starter.git example-project cd example-project rm -rf .git/
-
Create the
.env
file:cp .env.example .env
-
Install composer dependencies, then start Octane (FrankenPHP):
docker-compose up -d
-
Set application key, create the database and run migrations:
docker-compose exec php composer run post-create-project-cmd
-
Install front end dependencies:
pnpm install
-
Run the Vite dev server:
pnpm run dev
-
Go to https://localhost/, accept the potential security risk (it's a self-signed certificate), and you should see the Laravel welcome page.
Back end:
# Use composer
docker-compose exec php composer install
docker-compose exec php composer update
docker-compose exec php composer require --dev foo/bar
# Run tests
docker-compose exec php composer run test
# Run phpstan
docker-compose exec php composer run phpstan
# Run php-cs-fixer
docker-compose exec php composer run php-cs-fixer
# Run phpcs
docker-compose exec php composer run phpcs
Front end:
# Run the Vite dev server
pnpm run dev
# Run tsc & build assets for production
pnpm run build
# Run tests
pnpm run test
# Run tests with coverage report, output at coverage/
pnpm run coverage
# Run eslint
pnpm run lint
# Run prettier
pnpm run format
# Run prettier with --check (used in CI only)
pnpm run format-check