Skip to content
Back to skills

Laravel Knowledge Patch

ASecurity

Laravel

  • 25 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
developmentphpsqltestingapidatabasefrontendsecurity

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill laravel-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Laravel Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Laravel Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-laravel-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-laravel-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: laravel-knowledge-patch
description: Laravel
version: "13.43.0"
license: MIT
metadata:
  author: Nevaberry
---




# Laravel Knowledge Patch

Load this skill when upgrading Laravel applications or working on the framework
APIs, configuration, and behavior described below. Use the quick reference for
compatibility changes, then open the topic reference for examples and conditions.

## Reference index

| Reference | Topics |
| --- | --- |
| [Cache, sessions, and filesystems](references/cache-session-and-filesystem.md) | Cache contracts, serialization, locks, Redis, sessions, disks, uploads |
| [Database, Eloquent, and schema](references/database-eloquent-and-schema.md) | Connections, queries, migrations, casts, relationships, factories, search |
| [Events, observability, and operations](references/events-observability-and-operations.md) | Context, logging, events, exceptions, maintenance, command prohibitions |
| [Framework core and container](references/framework-core-and-container.md) | Dependencies, contracts, bindings, injection, collections, helpers, AI SDK |
| [HTTP, routing, and processes](references/http-routing-and-processes.md) | Routes, middleware, input, responses, HTTP clients, pools, batches, timeouts |
| [Mail, notifications, and broadcasting](references/mail-notifications-and-broadcasting.md) | Transports, attachments, notification hooks, queued mail, broadcast drivers |
| [Queues, jobs, and scheduling](references/queues-jobs-and-scheduling.md) | Dispatch, attributes, retries, managed queues, workers, metrics, schedules |
| [Testing, CLI, and tooling](references/testing-cli-and-tooling.md) | Test compatibility, fakes, assertions, parallel tests, generators, upgrades |
| [Validation, authentication, and security](references/validation-auth-and-security.md) | Rules, strict requests, JSON Schema, CSRF, passwords, rate limits, encryption |
| [Views, resources, and frontend](references/views-resources-and-frontend.md) | Starter kits, Blade, Vite, JSON:API, pagination, translations, images |

## Breaking changes and deprecations

### Runtime and installed packages

Laravel 13 requires PHP 8.3 or later. Set `laravel/framework` to `^13.0` in
`composer.json`. For packages in use, set `laravel/boost` to `^2.0`,
`laravel/tinker` to `^3.0`, `phpunit/phpunit` to `^12.0`, and `pestphp/pest` to `^4.0`.
Laravel 13.43 requires Horizon 5.47.0 or later when Horizon is installed.

### Cache and session compatibility

The default application cache configuration sets `serializable_classes` to
`false`. If you cache objects, list their classes explicitly or use array payloads.
The Laravel 13 application skeleton sets `'serialization' => 'json'` in
`config/session.php`. Switching from `php` to `json` invalidates active sessions,
so keep `php` if the upgrade must preserve them or if the application stores PHP
objects in sessions.

With framework fallback configuration and `APP_NAME="My App"`, defaults become
`my-app-cache-`, `my-app-database-`, and `my-app-session`. To preserve the previous
values for that app, set `CACHE_PREFIX=my_app_cache_`,
`REDIS_PREFIX=my_app_database_`, and `SESSION_COOKIE=my_app_session`.
The `apc` cache driver was removed; select another store if it is still in use.

### Eloquent identity, scopes, and booting

`HasUuids` generates UUIDv7 IDs and replaces the removed `HasVersion7Uuids` trait.
To retain ordered UUIDv4 IDs, use
`Illuminate\Database\Eloquent\Concerns\HasVersion4Uuids as HasUuids`.
The local scope attribute was renamed from `#[NamedScope]` to `#[Scope]`;
update the model attribute and import `Illuminate\Database\Eloquent\Attributes\Scope`.

Instantiating a model while that class is still booting throws a `LogicException`.
Move calls such as `new static()` out of the model's `boot()` and trait boot methods.
Version 13.26.1 removes `orWhereKey()` and `orWhereKeyNot()`; use `whereKey()` or
`whereKeyNot()` inside an `orWhere()` closure there. Laravel 13.27 restores both
helpers while preserving compatibility with custom builder subclasses.

### Database extension points and writes

Pass an `Illuminate\Database\Connection` as the first constructor argument to
`Illuminate\Database\Schema\Blueprint` and grammar classes.
`Grammar::setConnection()` and `Connection::withTablePrefix()` were removed.
Replace deprecated `Blueprint::getPrefix()` and `Grammar::getTablePrefix()` calls
with `$connection->getTablePrefix()`. `Grammar::setTablePrefix()` is also deprecated.

Pass a non-empty `uniqueBy` to `upsert()` to avoid an `InvalidArgumentException`.
MySQL and MariaDB detect conflicts using the table's primary and unique indexes.
The MySQL grammar includes `ORDER BY` and `LIMIT` in joined deletes; engines that
reject those clauses on joined deletes can throw a `QueryException`.

### Custom contracts and overrides

Custom implementations must provide the additions for the contract they implement:

| Contract or extension point | Required addition or compatible signature |
| --- | --- |
| Cache `Store` and `Repository` | `touch`; custom `Store` implementations provide `touch($key, $seconds)` |
| `Illuminate\Contracts\Bus\Dispatcher` | `dispatchAfterResponse($command, $handler = null)` |
| `Illuminate\Contracts\Routing\ResponseFactory` | `eventStream`; `ResponseFactory::streamJson()` is also required |
| `Illuminate\Contracts\Auth\MustVerifyEmail` | `markEmailAsUnverified()` |
| `Illuminate\Contracts\Queue\Queue` | `pendingSize`, `delayedSize`, `reservedSize`, `creationTimeOfOldestPendingJob` |
| `Illuminate\Contracts\Queue\Monitor` | `starting()` |
| `Illuminate\Support\Enumerable` | `hasSole()` and `hasMany()` |
| `Illuminate\Contracts\Mail\Mailer` | `cc()` |
| `CursorPaginator`, `Paginator`, `Session` | `hasMorePages()`, `withQueryString()`, `flash()`, respectively |
| `Illuminate\Http\Client\Response` overrides | `throw($callback = null)` and `throwIf($condition, $callback = null)` |

### Requests, routing, and forgery protection

`Request::get()` is deprecated. Use `$request->input('status')` for submitted input
or `$request->query('status')` for query parameters.
Duplicate route-name lookup selects the first registered route, matching cached
routing. Explicit-domain routes take matching precedence over routes without a domain.

`Illuminate\Foundation\Http\Middleware\PreventRequestForgery` uses `Sec-Fetch-Site`
to verify request origin. Update exclusions for deprecated `VerifyCsrfToken` and
`ValidateCsrfToken` aliases to `->withoutMiddleware([PreventRequestForgery::class])`
and use `preventRequestForgery()` for configuration. Token-based clients can
continue sending CSRF tokens.

### Queue events and deferred registration

Read `Illuminate\Queue\Events\JobAttempted::$exception` for the exception or `null`.
Replace `$exceptionOccurred` reads with `$event->exception !== null` for a boolean.
`Illuminate\Queue\Events\QueueBusy::$connection` was renamed to `$connectionName`.
`ApplicationBuilder::withScheduling()` runs its callback when `Schedule` resolves;
move work that must happen during bootstrap outside that callback.

### Other compatibility checks

The `Illuminate\Auth\Passwords\DatabaseTokenRepository` constructor takes `$expires`
in seconds; pass `3600` for one hour when constructing it directly.
If the `local` disk is omitted from `config/filesystems.php`, its implicit root is
`storage/app/private`. Explicitly set `root` to `storage_path('app')` to retain the
previous location. Give each served filesystem disk its own URI; duplicates throw.

`Factory::$modelNameResolver` is deprecated; set the factory's `$model` property
explicitly when its model differs from the naming convention. Laravel Breeze and
Laravel Jetstream will receive no further updates following the Laravel 12 starter kits.

## Frequently used APIs

### Container resolution and lifetimes

Auto-resolved class dependencies honor declared constructor defaults. A contextual
class binding takes precedence over that default. `Container::call()` uses a
nullable class parameter's default when the class has no binding.
`#[Singleton]` shares an instance for the container lifetime; `#[Scoped]` shares one
per request or queue job lifecycle. Both attributes also apply on interfaces.

### Database queries and model state

`chunk()` honors the query offset and total limit. In 13.31, `lazy()` and `lazyById()`
also honor `limit()` and `offset()`.
After saving, `$model->getPrevious()` returns values from before the last save;
`$model->getChanges()` returns values written by that save.
`BelongsToMany` `*OrFail` methods run pivot changes in a transaction and roll back
on exceptions. In 13.34, morph-map enforcement checks stored types on reads too;
update legacy values to mapped aliases when preparing existing data for enforcement.

### HTTP pools and batches

`Http::batch()` groups concurrent requests and supports callbacks for batch outcomes.
Call `send()` to dispatch and receive responses, or `->defer()` to dispatch after
the response is sent. Results follow request insertion order.
Use `Http::pool($requests, concurrency: 5)` or
`Http::batch($requests)->concurrency(5)->send()` to cap requests in flight.
HTTP pools default to two simultaneous requests when `concurrency` is omitted.

### Validation and JSON Schema

`FormRequest::failOnUnknownFields()` rejects fields absent from validation rules;
`FormRequest::flushState()` clears that global setting between tests. In 13.35,
strict form requests ignore `_token` and `_method` in unknown-field checks.
Use `boolean:strict` for PHP booleans and `numeric:strict` for integers or floats,
rejecting numeric strings. `Rule::numeric()->integer(strict: true)` also rejects floats.
The `image` rule excludes SVG by default; opt in with `image:allow_svg` or `allowSvg: true`.

In 12.73 and 13.43, `JsonSchema::rules($schema)` derives validator rules from a schema.
The 13.43 conversion supports `exclusiveMinimum` and `exclusiveMaximum`.
Fluent `exists` and `unique` rule `where()` values are literal in those releases;
use `whereNull()` for an SQL null check.

### Jobs and schedules

`Queue::route(ProcessPodcast::class, connection: 'redis', queue: 'podcasts')` sets
job routing centrally. Job attributes include `#[Tries(3)]`, `#[Timeout(120)]`,
`#[Backoff]`, and `#[FailOnTimeout]`. Explicit `onQueue()` takes precedence over
the job class's queue attribute. `Bus::bulk()` enqueues several job instances.

`php artisan queue:pause redis:emails` pauses new work on the named queue;
`php artisan queue:continue redis:emails` resumes it. `php artisan schedule:pause`
and `php artisan schedule:resume` suspend and restore scheduled task execution.
In 13.43, `$this->releaseUsingBackoff()` on a job using `InteractsWithQueue` releases
it using configured backoff; `#[RetryFor]` sets its retry eligibility window.

### Cache reads, context, and operations

`Cache::memo()->flexible('report', [60, 300], $buildReport)` provides
stale-while-revalidate through the memoized cache. `Cache::rememberWithState()`
returns cache state alongside the remembered value.
`Context::scope()` restores surrounding context when its callback exits.
`Context::remember()` computes and stores a value only if missing;
`Context::rememberHidden()` does the same for hidden context.
Run `php artisan reload` after deploying to signal registered long-running
services to reload; it also signals the scheduler to interrupt its current loop.

### Resources, Blade, and tests

Extend `JsonApiResource` for Eloquent attributes and relationships in JSON:API
responses; resources support sparse fieldsets, links, and JSON:API response headers.
`@includeIsolated('orders.summary', ['order' => $order])` keeps parent view locals
out of the partial's scope. Use `RawTemplate` for inline Blade source returned
by a class component in 13.43.

`WithCachedRoutes` and `WithCachedConfig` boot tests with cached routes or config;
the latter also supports parallel tests. `Bus::assertNothingDispatched()` checks
synchronous and after-response dispatches too. Test teardown resets custom UUID,
ULID, and random string factories on `Str`; register them per test or in setup.

Files in this skill

  • SKILL.md12.5 KB
  • coverage.json2.4 KB
  • references/cache-session-and-filesystem.md5.8 KB
  • references/database-eloquent-and-schema.md16.8 KB
  • references/events-observability-and-operations.md2.8 KB
  • references/framework-core-and-container.md13 KB
  • references/http-routing-and-processes.md7.7 KB
  • references/mail-notifications-and-broadcasting.md3.5 KB
  • references/queues-jobs-and-scheduling.md11.9 KB
  • references/testing-cli-and-tooling.md8.3 KB
  • references/validation-auth-and-security.md6.5 KB
  • references/views-resources-and-frontend.md3.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.