Skip to content

Instantly share code, notes, and snippets.

@thinkstylestudio
Forked from michaelsieminski/AppServiceProvider.php
Created February 22, 2025 04:03
Show Gist options
  • Save thinkstylestudio/53b72207d9f39079944e3c2c43d3cd54 to your computer and use it in GitHub Desktop.
Save thinkstylestudio/53b72207d9f39079944e3c2c43d3cd54 to your computer and use it in GitHub Desktop.
Modern PHP Tooling

Modern PHP Tooling

This is my personal collection of modern PHP Tooling that I setup for all of my Laravel projects.

Linting

  1. Pint - Formatting
  1. PeckPHP - Fix Typos
  1. RectorPHP - Use modern php syntax

Types

  1. PHPStan - PHP Type Checker
  1. Larastan - Laravel Code Analysis
  1. Pinkary TypeGuard - Cleaner typed Variables
  1. Setup phpstan.neon config

Testing

  1. PestPHP - Testing Framework
  • Install PestPHP
  • In phpunit.xml comment in DB_CONNECTION & DB_DATABASE variables
  1. Pest Type Coverage - Measure Type Coverage in the Code

Development Tools

  1. Clockwork - Identify Performance Issues
  1. Solo - Merge all running Terminals into one
  • Install Solo
  • Setup commands in solo.php config
  1. Composer Scripts
"scripts": {
"lint": "pint",
"refactor": "rector",
"test:lint": "pint --test",
"test:refactor": "rector --dry-run",
"test:types": "phpstan analyse",
"test:arch": "pest --filter=arch",
"test:type-coverage": "pest --type-coverage --min=100",
"test:unit": "pest --parallel --coverage --exactly=99.4",
"test": [
"@test:lint",
"@test:refactor",
"@test:types",
"@test:type-coverage",
"@test:unit"
]
}
includes:
- vendor/larastan/larastan/extension.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters:
level: max
paths:
- app
- config
- bootstrap
- database/factories
- routes
{
"preset": "laravel",
"rules": {
"array_push": true,
"backtick_to_shell_exec": true,
"declare_strict_types": true,
"final_class": true,
"fully_qualified_strict_types": true,
"global_namespace_import": {
"import_classes": true,
"import_constants": true,
"import_functions": true
},
"ordered_class_elements": {
"order": [
"use_trait",
"case",
"constant",
"constant_public",
"constant_protected",
"constant_private",
"property_public",
"property_protected",
"property_private",
"construct",
"destruct",
"magic",
"phpunit",
"method_abstract",
"method_public_static",
"method_public",
"method_protected_static",
"method_protected",
"method_private_static",
"method_private"
],
"sort_algorithm": "none"
},
"ordered_interfaces": true,
"ordered_traits": true,
"protected_to_private": true,
"strict_comparison": true
}
}
'commands' => [
'Vite' => 'bun dev',
'Logs' => EnhancedTailCommand::file(storage_path('logs/laravel.log')),
'Tests' => Command::from('php artisan test --colors=always --parallel')->lazy(),
'Pint' => Command::from('./vendor/bin/pint')->lazy(),
'Peck' => Command::from('./vendor/bin/peck')->lazy(),
'Reverb' => Command::from('php artisan reverb')->lazy(),
'Queue' => Command::from('php artisan queue:work')->lazy(),
'Stripe' => Command::from('stripe listen --forward-to orysuite-app.test/stripe/webhook')->lazy(),
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment