Skip to content

Instantly share code, notes, and snippets.

View nathanbarrett's full-sized avatar

Nathan Barrett nathanbarrett

View GitHub Profile
@nathanbarrett
nathanbarrett / BaseEnum.php
Last active November 28, 2023 22:57
A base enum simulator for PHP versions below 8.1
<?php declare(strict_types=1);
namespace App\Enums;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
/**
* Simulator for PHP 8 enums to make it easy to upgrade to actual enums when they become available.
* The only thing you need to check after upgrading the child class to an enum is
* the equality check in the equals method in the implementation. Replace with an actual equality check
@nathanbarrett
nathanbarrett / laravel-php-style-guide.md
Last active August 3, 2025 14:41
Laravel & PHP Style Guide

Laravel & PHP Guidelines for AI Code Assistants

This file contains Laravel and PHP coding standards optimized for AI code assistants like Claude Code, GitHub Copilot, and Cursor. These guidelines are derived from Spatie’s comprehensive Laravel & PHP standards, combined with personalized practices.

Core Laravel Principle

Follow Laravel conventions first. If Laravel has a documented way to do something, use it. Only deviate when you have a clear justification.

PHP Standards

  • Follow PSR-1, PSR-2, and PSR-12