Overview
GB App follows industry-standard coding conventions for Laravel (PHP) and Vue.js (JavaScript). Consistency in code style makes the codebase maintainable and easier to collaborate on.PHP/Laravel Standards
PSR-12 Compliance
GB App follows PSR-12: Extended Coding Style for all PHP code. Key Rules:- Use 4 spaces for indentation (no tabs)
- Opening braces for classes and methods on the next line
- Opening braces for control structures on the same line
- One statement per line
Laravel Pint
Use Laravel Pint to automatically format code:pint.json
Naming Conventions
Controllers
- Use singular, PascalCase nouns
- Suffix with
Controller - RESTful method names:
index,create,store,show,edit,update,destroy
Models
- Singular, PascalCase nouns
- Represent database entities
Routes
- Lowercase with hyphens for URLs
- Use resource routes when possible
Database
- Table names: plural, snake_case
- Column names: singular, snake_case
- Foreign keys:
{model}_id - Pivot tables: alphabetical order, snake_case
Type Hinting
Always use type hints for parameters and return types:Eloquent Best Practices
Use Mass Assignment Protection
Define Relationships Clearly
Use Scopes for Reusable Queries
Controller Organization
Single Responsibility
Each controller should handle one resource:Dependency Injection
Validation
Use Form Requests
Comments and Documentation
DocBlocks
Use PHPDoc for public methods:Inline Comments
Comment complex logic, not obvious code:Vue.js/JavaScript Standards
Vue Component Structure
Use the standard order:Component Naming
- PascalCase for component files:
ReportCard.vue,UserList.vue - kebab-case in templates:
<report-card>,<user-list>
Props Definition
Always define prop types:Event Handling
Use descriptive event names:JavaScript Style
Use ES6+ Features
Destructuring
Tailwind CSS Guidelines
Class Order
Follow a consistent order:- Layout (display, position)
- Box model (width, height, padding, margin)
- Typography (font, text)
- Visual (background, border)
- Misc (cursor, transform)
Extract Repeated Patterns
For commonly repeated class combinations, create components:Git Commit Standards
Commit Message Format
Use conventional commits:feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting)refactor: Code refactoringtest: Adding testschore: Maintenance tasks
Branch Naming
feature/description- New featuresfix/description- Bug fixesrefactor/description- Code refactoringdocs/description- Documentation updates
Code Review Checklist
Before submitting a pull request:- Code follows PSR-12 (run
./vendor/bin/pint --test) - All tests pass (
php artisan test) - New features have tests
- No debug statements (
dd(),dump(),console.log()) - Comments explain “why”, not “what”
- Type hints used for all methods
- Validation uses Form Requests
- Database changes have migrations
- Frontend follows Vue.js style guide
- Commit messages are descriptive
Next Steps
Development Setup
Set up your development environment
Testing Guide
Learn how to write and run tests
Architecture
Understand the system architecture
Database Schema
Explore the database structure