Copy Error Sebagai Markdown Dengan AI di Laravel 12.25

Copy Error Sebagai Markdown Dengan AI di Laravel 12.25
Copy Error Sebagai Markdown Dengan AI di Laravel 12.25

The Laravel team released v12.25.0 with a "Copy as Markdown" button on the error page, defining allowed URL patterns when preventing stray requests in the HTTP client, and more:

#Copy Errors as Markdown

Marcel Pociot contributed a "Copy as Markdown" button on the Laravel error page. As Marcel mentions in the pull request description, the markdown representation can be used with AI:

When clicking this button, we copy a markdown representation of the exception to the users clipboard, which can then be used for AI agents/LLMs.

The markdown contains all the information that is also visible on the page:

Exception title, class, message

PHP and Laravel Version

Request and route context

Application context

The button is near the top right of the page, and the clipboard copy works with local (http) environments as well as HTTPS:

The "Copy as Markdown" button in dark mode.

The "Copy as Markdown" button in dark mode.

Here's an example of an error (abbreviated) I created locally to demonstrate:

# Error - Internal Server Error

Call to undefined function error_here()

PHP 8.3.22

Laravel 12.25.0

localhost:8000

## Stack Trace

0 - resources/views/welcome.blade.php:21

1 - vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:123

2 - vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:124

3 - vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:57

4 - vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php:76

5 - vendor/laravel/framework/src/Illuminate/View/View.php:208

6 - vendor/laravel/framework/src/Illuminate/View/View.php:191

...

## Request

GET /

## Headers

* host: localhost:8000

* user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:141.0) Gecko/20100101 Firefox/141.0

* accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

* accept-language: en-US,en;q=0.5

...

## Route Context

controller: Closure

middleware: web

## Route Parameters

No route parameter data available.

## Database Queries

sqlite - select from "sessions" where "id" = 'uOnPTV8XE51BLUrKqXW1jkzKPvuhDbg8zHTgp3Bc' limit 1 (0.6 ms)

See Pull Request #56657 for details.

#Allowed URLs Through Stray Requests

Richard Browne contributed the ability to pass an allowed list of request patterns when calling the preventStrayRequests() method in a test:

Http::allowStrayRequests([

'http://127.0.0.1:13714/*',

]);

// Works on a PendingRequest instance

$pendingRequest->allowStrayRequests([

'http://127.0.0.1:13714/*',

]);

$pendingRequest->isAllowedRequestUrl($url); // bool

See Pull Request #56645 for details.

#Release notes

You can see the complete list of new features and updates below and the diff between 12.24.0 and 12.25.0 on GitHub. The following release notes are directly from the changelog:

#v12.25.0

[12.x] Prioritize Current Schema When Resolving the Table Name in db:table Command by @hafezdivandari in https://github.com/laravel/framework/pull/56646

[12.x] Add allowedUrls through preventStrayRequests by @rabrowne85 in https://github.com/laravel/framework/pull/56645

[12.x] Add "Copy as Markdown" button to error page by @mpociot in https://github.com/laravel/framework/pull/56657

[12.x] Indicate that Context@scope() may throw by @cosmastech in https://github.com/laravel/framework/pull/56655

[12.x] Remove @throws phpDocs in the TransformToResource trait by @adelf in https://github.com/laravel/framework/pull/56667

[12.x] Improve docblocks for InteractsWithDatabase by @cosmastech in https://github.com/laravel/framework/pull/56666

[12.x] Fix prevent group attribute pollution in schedule by @People-Sea in https://github.com/laravel/framework/pull/56677

Add new mergeVisible, mergeHidden and mergeAppends methods. by @jonerickson in https://github.com/laravel/framework/pull/56678

Artikel Terkait