Skip to content

Instantly share code, notes, and snippets.

View robmellett's full-sized avatar

Rob Mellett robmellett

View GitHub Profile
@robmellett
robmellett / agents.md
Created October 9, 2025 02:08
Phpstan Agents.md

MCP Agents Guide: PHPStan Rules

A field manual for autonomous or human agents working in PHP repos using PHPStan. Copy this into your project’s docs/agents/phpstan.md and adapt as needed.


1) Mission & Scope

  • Mission: Keep code safe, boring, and predictable by enforcing static analysis with PHPStan at a consistent level across services.
  • Scope: All PHP source, tests, and frameworks (Laravel/Symfony/etc.) with framework-specific add‑ons (e.g., Larastan).
@robmellett
robmellett / agents.md
Created October 9, 2025 02:01
Laravel Domain Driven Design Agents.md

🧠 Agents.md — Domain-Driven Development Guide for Laravel

This document defines how engineers should design and implement agents (domains, actions, and data flows) following Domain-Driven Design (DDD) principles within a Laravel application.


🏗️ 1. Purpose

An agent represents a coherent business capability — for example, Subscriber, Broadcast, Invoice, or Automation.
Each agent encapsulates all logic, data, and rules that belong to its business area.

@robmellett
robmellett / compose.yml
Created October 8, 2025 13:49
Default Laravel 12 | Sail | Docker Compose
services:
laravel.test:
build:
context: './vendor/laravel/sail/runtimes/8.4'
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: 'sail-8.4/app'
extra_hosts:
- 'host.docker.internal:host-gateway'
@robmellett
robmellett / log query
Created August 25, 2023 07:24 — forked from viezel/log query
Laravel Vapor - Cloudwatch insights logs
fields @timestamp, @message
# Lambda
| filter @message not like "START RequestId"
| filter @message not like "END RequestId"
| filter @message not like "REPORT RequestId"
# FPM
| filter @message not like "NOTICE: ready to handle connections"
| filter @message not like "NOTICE: fpm is running"
@robmellett
robmellett / example.php
Last active February 4, 2021 05:51
Laravel Methods that accept Arrays or Collections
/**
* Create a Collection of new instances of the related model.
*
* @param iterable $records
* @return \Illuminate\Database\Eloquent\Collection
*/
public function createMany(iterable $records)
{
$instances = $this->related->newCollection();
@robmellett
robmellett / renovate.json
Last active February 1, 2021 21:55
Github Renovate
{
"extends": ["config:base"],
"automerge": true,
"major": {
"automerge": false
},
"labels": ["type: dependencies", "renovate"],
"masterIssue": true,
"prConcurrentLimit": 3,
"prHourlyLimit": 2,
@robmellett
robmellett / index.js
Created January 20, 2021 13:42
ES6 Pagination
function getPagingRange(current, { min = 1, total = 20, length = 5 } = {}) {
if (length > total) length = total;
let start = current - Math.floor(length / 2);
start = Math.max(start, min);
start = Math.min(start, min + total - length);
return Array.from({ length: length }, (el, i) => start + i);
};
@robmellett
robmellett / Component.vue
Created January 17, 2021 05:33
Vue.js Currency Filter
<template>
<div
v-if="this.$route.name != 'orders-Confirmation'"
class="py-2 text-center bg-blue-600 text-white"
>
<button
v-if="this.$route.name != 'checkout'"
>
<nuxt-link
:to="{ name: 'checkout' }"
@robmellett
robmellett / AppServiceProvider.php
Created December 24, 2020 00:27
Allow for Configuration Hooks
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
@robmellett
robmellett / AppServiceProvider.php
Created November 4, 2020 06:14
Monitor Laravel DB Connections
<?php
namespace App\Providers;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void