Menu

## PioniaRouter
in package

PioniaRouter.php : 36

This is the basis for defining routes in the application.

You can only add `post` and `get` routes as that what the framework tends to support.

If you need more methods, you can add them to the SupportedHttpMethods class and implement them here. However, this is meant for core framework developers only.

##### Tags

example

      // deprecated version
      $router = new PioniaRouter();
      $router->addGroup('app\controller\MyController')
         ->post('myAction', 'myAction')
        ->get('myAction', 'myAction');

      // new version
      $router = new PioniaRouter();
      $router->addSwitchFor('app\switches\MySwitch', 'v1');

author

  Jet - ezrajet9@gmail.com

### Table of Contents

#### Properties

$routes : BaseRoutes
$apiBase : string

#### Methods

__construct() : mixed
addSwitchFor() : PioniaRouter
getRoutes() : BaseRoutes
wireTo() : PioniaRouter
  Adds a switch for a certain api version
cleanVersion() : string

### Properties

#### $routes

PioniaRouter.php : 38
`protected BaseRoutes $routes`

#### $apiBase

PioniaRouter.php : 40
`private string $apiBase = '/api/'`

### Methods

#### __construct()

PioniaRouter.php : 47
`public __construct([BaseRoutes|null $routes = null ]) : mixed`

##### Parameters

$routes : BaseRoutes|null = null

#### addSwitchFor()

PioniaRouter.php : 107
`public addSwitchFor(string $switch[, string|null $versionName = 'v1' ]) : PioniaRouter`

##### Parameters

$switch : string
$versionName : string|null = 'v1'

##### Tags

throws
  Exception

##### Return values

PioniaRouter

#### getRoutes()

PioniaRouter.php : 42
`public getRoutes() : BaseRoutes`

##### Return values

BaseRoutes

#### wireTo()

PioniaRouter.php : 66

Adds a switch for a certain api version

`public wireTo(string $switch[, string|null $versionName = 'v1' ]) : PioniaRouter`

##### Parameters

$switch : string

  The switch to add

$versionName : string|null = 'v1'

  The version name to add the switch to

##### Tags

throws
  Exception
example

      $router = new PioniaRouter();
      $router->addSwitchFor('app\switches\MySwitch', 'v1');

##### Return values

PioniaRouter

#### cleanVersion()

PioniaRouter.php : 112
`private cleanVersion(string $str) : string`

##### Parameters

$str : string

##### Return values

string

## Search results