CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.1 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.1
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
      • Exception
      • Filter
      • Route
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class RouteCollection

Contains a collection of routes.

Provides an interface for adding/removing routes and parsing/generating URLs with the routes it contains.

Namespace: Cake\Routing

Property Summary

  • $_extensions protected
    array

    Route extensions

  • $_named protected
    array

    The hash map of named routes that are in this collection.

  • $_paths protected
    array

    Routes indexed by path prefix.

  • $_routeTable protected
    array

    The routes connected to this collection.

  • $_routes protected
    array

    The routes connected to this collection.

Method Summary

  • _getNames() protected

    Get the set of names from the $url. Accepts both older style array urls, and newer style urls containing '_name'

  • add() public

    Add a route to the collection.

  • extensions() public

    Get/set the extensions that the route collection could handle.

  • match() public

    Reverse route or match a $url array with the defined routes. Returns either the string URL generate by the route, or false on failure.

  • named() public

    Get the connected named routes.

  • parse() public

    Takes the URL string and iterates the routes until one is able to parse the route.

  • routes() public

    Get all the connected routes as a flat list.

Method Detail

_getNames() ¶ protected

_getNames(array $url): array

Get the set of names from the $url. Accepts both older style array urls, and newer style urls containing '_name'

Parameters
array $url

The url to match.

Returns
array

add() ¶ public

add(Cake\Routing\Route\Route $route, array $options = []): void

Add a route to the collection.

Parameters
Cake\Routing\Route\Route $route

The route object to add.

array $options optional

Additional options for the route. Primarily for the _name option, which enables named routes.

Returns
void

extensions() ¶ public

extensions(null|string|array $extensions = null, bool $merge = true): array

Get/set the extensions that the route collection could handle.

Parameters
null|string|array $extensions optional

Either the list of extensions to set, or null to get.

bool $merge optional

Whether to merge with or override existing extensions. Defaults to true.

Returns
array

match() ¶ public

match(array $url, array $context): string|false

Reverse route or match a $url array with the defined routes. Returns either the string URL generate by the route, or false on failure.

Parameters
array $url

The url to match.

array $context

The request context to use. Contains _base, _port, _host, _scheme and params keys.

Returns
string|false
Throws
Cake\Routing\Exception\MissingRouteException
when a route cannot be matched.

named() ¶ public

named(): array

Get the connected named routes.

Returns
array

parse() ¶ public

parse(string $url): array

Takes the URL string and iterates the routes until one is able to parse the route.

Parameters
string $url

URL to parse.

Returns
array
Throws
Cake\Routing\Exception\MissingRouteException
When a URL has no matching route.

routes() ¶ public

routes(): array

Get all the connected routes as a flat list.

Returns
array

Property Detail

$_extensions ¶ protected

Route extensions

Type
array

$_named ¶ protected

The hash map of named routes that are in this collection.

Type
array

$_paths ¶ protected

Routes indexed by path prefix.

Type
array

$_routeTable ¶ protected

The routes connected to this collection.

Type
array

$_routes ¶ protected

The routes connected to this collection.

Type
array
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs