Fresh code drop

Attach structured metadata to routes

PHP

Laravel 13 API example based on official Laravel documentation. Source: https://laravel.com/framework/docs/changelog#add-route-metadata-support

PHP
CodeSnap // free canvas

Attach structured metadata to routes

<?php

Route::get('/pricing', PricingController::class)
    ->metadata([
        'seo' => ['title' => 'Pricing', 'robots' => 'index'],
        'feature' => 'public-pricing',
    ]);

$title = request()->route()->getMetadata('seo.title');

// Further reading: https://laravel.com/framework/docs/changelog#add-route-metadata-support

Turn your code into a post.Five templates are free—no account needed.

Remix this snap