Neuron-PHP

Get extends Route

GET route attribute for defining GET HTTP routes on controller methods.

Tags
example
#[Get('/users')]
public function index() { }

#[Get('/users/:id', name: 'users.show', filters: ['auth'])]
public function show(int $id) { }
Attributes
#[Attribute]
\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE

Table of Contents

Properties

$filters  : array<string|int, mixed>
$method  : string
$name  : string|null
$path  : string

Methods

__construct()  : mixed
getFilters()  : array<string|int, mixed>
Get the filters
getMethod()  : string
Get the HTTP method
getName()  : string|null
Get the route name
getPath()  : string
Get the route path

Properties

$filters read-only

public array<string|int, mixed> $filters = []

$method read-only

public string $method = 'GET'

$name read-only

public string|null $name = null

$path read-only

public string $path

Methods

__construct()

public __construct(string $path[, string|null $name = null ][, array<string|int, mixed> $filters = [] ]) : mixed
Parameters
$path : string

The route path (e.g., '/users/:id')

$name : string|null = null

Optional route name for URL generation

$filters : array<string|int, mixed> = []

Array of filter names to apply to this route

getFilters()

Get the filters

public getFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMethod()

Get the HTTP method

public getMethod() : string
Return values
string

getName()

Get the route name

public getName() : string|null
Return values
string|null

getPath()

Get the route path

public getPath() : string
Return values
string

        
On this page

Search results