Skip to content

Commit 5d8be34

Browse files
committed
Add Laravel 13 support
Widen illuminate/contracts constraint to accept ^13.0 alongside ^12.0. Update orchestra/testbench and nunomaduro/collision dev dependencies for Laravel 13 compatibility.
1 parent 40f5712 commit 5d8be34

2 files changed

Lines changed: 63 additions & 3 deletions

File tree

CLAUDE.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
`dev-to-geek/laravel-init` is a Laravel package that bootstraps Laravel projects with preconfigured development tools (Pint, Larastan, Pest, Pail, Rector, Laravel Boost) via a single artisan command: `php artisan laravel-init:install`.
8+
9+
- **PHP:** ^8.3 | **Laravel:** ^12.0, ^13.0
10+
- **Namespace:** `Dev2Geek\LaravelInit`
11+
- All files must use `declare(strict_types=1)`
12+
13+
## Commands
14+
15+
```bash
16+
composer test # Run tests (Pest)
17+
composer test-coverage # Parallel tests with coverage
18+
composer analyse # PHPStan static analysis (level 10, 2G memory)
19+
composer format # Code formatting (Pint, Laravel preset)
20+
composer refactor # Rector automated refactoring
21+
```
22+
23+
Run a single test file:
24+
```bash
25+
vendor/bin/pest tests/Feature/InstallCommandTest.php
26+
```
27+
28+
Run a single test by name:
29+
```bash
30+
vendor/bin/pest --filter="can run laravel-init:install command"
31+
```
32+
33+
## Architecture
34+
35+
The package has a minimal structure with one primary flow:
36+
37+
**ServiceProvider** (`src/LaravelInitServiceProvider.php`) registers a single artisan command and merges config.
38+
39+
**InstallCommand** (`src/Commands/InstallCommand.php`) is the core of the package. It sequentially installs tools via `Process::run()` composer commands, copies configuration stubs via `File::copy()`, and wraps each step in `spin()` for terminal feedback. Each step fails fast with `self::fail()` on error. The `--remove-me` flag triggers self-uninstallation.
40+
41+
**Stubs** (`stubs/`) contain configuration templates (pint.json, phpstan.neon.dist, rector.php) that get copied to the target project root during installation.
42+
43+
## Testing
44+
45+
Tests use **Pest** with **Orchestra Testbench**. The base `TestCase` (`tests/TestCase.php`) extends `Orchestra\Testbench\TestCase` and registers the package's service provider.
46+
47+
Testing patterns used throughout:
48+
- `Process::fake()` with pattern matching to mock composer commands
49+
- `File::spy()` / `File::shouldReceive()` for filesystem mocking
50+
- `$this->artisan('laravel-init:install')` for command integration tests
51+
- Arrange/Act/Assert structure in every test
52+
53+
Architecture tests (`tests/ArchTest.php`) enforce no debug functions (`dd`, `dump`, `ray`).
54+
55+
## Code Quality Standards
56+
57+
- **PHPStan level 10** (maximum) with Larastan — analyzes `src/` only
58+
- **Pint** with Laravel preset plus strict rules: `strict_comparison`, `declare_strict_types`, `ordered_class_elements`, `protected_to_private`
59+
- **Rector** runs on `src/`, `config/`, `tests/` with sets: deadCode, codeQuality, typeDeclarations, privatization, earlyReturn, strictBooleans
60+
- Class element ordering: traits → constants → properties → constructor → magic → static methods → public → protected → private

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
],
1818
"require": {
1919
"php": "^8.3",
20-
"illuminate/contracts": "^12.0"
20+
"illuminate/contracts": "^12.0 || ^13.0"
2121
},
2222
"require-dev": {
2323
"larastan/larastan": "^v3.1",
2424
"laravel/pint": "^v1.21",
2525
"mockery/mockery": "*",
26-
"nunomaduro/collision": "^8.6.1",
27-
"orchestra/testbench": "^10.0",
26+
"nunomaduro/collision": "^8.6.1 || ^9.0",
27+
"orchestra/testbench": "^10.0 || ^11.0",
2828
"pestphp/pest": "^v4.0",
2929
"pestphp/pest-plugin-arch": "^4.0",
3030
"pestphp/pest-plugin-laravel": "^4.0",

0 commit comments

Comments
 (0)