Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Farshid Laravel
reyhan-commerce/reyhan
cursor
actions
thin-controllers
strict-typing
no-repositories
pest
transactions
idempotency

description: Farshid Laravel & PHP Coding Standards (Actions, Thin Controllers, Strict Typing, No Repositories, Pest) globs: /.php alwaysApply: true

Install
php artisan boost:add-skill reyhan-commerce/reyhan

Save this content to: .cursor/rules/farshid-laravel.mdc

---
description: Farshid Laravel & PHP Coding Standards (Actions, Thin Controllers, Strict Typing, No Repositories, Pest)
globs: **/*.php
alwaysApply: true
---

# Farshid's Laravel Coding Rules

- **Framework Native**: Prefer Laravel native features over custom abstractions.
- **Typing**: 100% strict parameter and return types across all methods. Avoid `mixed` and untyped arrays.
- **Architecture**:
  - Thin Controllers (FormRequest -> Action -> ApiResource).
  - Business logic lives in `final class [Verb][Noun]Action` with `execute()`.
  - Services only for grouping tightly coupled operations around a domain concept.
  - Strictly **NO Repositories**. Use Eloquent queries and Scopes directly.
  - Models: Use `protected function casts(): array` and `$guarded = ['id']`. No external I/O in models.
  - DTOs: Use `final readonly class` for typed structured contracts.
  - Enums: Use backed Enums with UPPERCASE cases (`OrderStatusEnum::PAID`).
- **Resilience**:
  - Never hold a `DB::transaction` open during external HTTP calls (e.g. Stripe).
  - Always guard against race conditions using `lockForUpdate()`, atomic locks, or DB constraints.
  - Implement business-level idempotency on mutating operations.
- **Testing**:
  - Use Pest (`it(...)`) with `RefreshDatabase`.
  - Feature tests for Actions (`tests/Feature/Actions/`) and HTTP APIs (`tests/Feature/Api/`).
  - Use `Http::fake()` for third-party endpoints.

description: Farshid Laravel & PHP Coding Standards (Actions, Thin Controllers, Strict Typing, No Repositories, Pest) globs: **/*.php alwaysApply: true

Farshid's Laravel Coding Rules

  • Framework Native: Prefer Laravel native features over custom abstractions.
  • Typing: 100% strict parameter and return types across all methods. Avoid mixed and untyped arrays.
  • Architecture:
    • Thin Controllers (FormRequest -> Action -> ApiResource).
    • Business logic lives in final class [Verb][Noun]Action with execute().
    • Services only for grouping tightly coupled operations around a domain concept.
    • Strictly NO Repositories. Use Eloquent queries and Scopes directly.
    • Models: Use protected function casts(): array and $guarded = ['id']. No external I/O in models.
    • DTOs: Use final readonly class for typed structured contracts.
    • Enums: Use backed Enums with UPPERCASE cases (OrderStatusEnum::PAID).
  • Resilience:
    • Never hold a DB::transaction open during external HTTP calls (e.g. Stripe).
    • Always guard against race conditions using lockForUpdate(), atomic locks, or DB constraints.
    • Implement business-level idempotency on mutating operations.
  • Testing:
    • Use Pest (it(...)) with RefreshDatabase.
    • Feature tests for Actions (tests/Feature/Actions/) and HTTP APIs (tests/Feature/Api/).
    • Use Http::fake() for third-party endpoints.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle