2017 © Pedro Peláez
 

typo3-cms-extension routing

Service to route HTTP/REST requests to your own controller/actions.

image

causal/routing

Service to route HTTP/REST requests to your own controller/actions.

  • Thursday, January 25, 2018
  • by xperseguers
  • Repository
  • 4 Watchers
  • 17 Stars
  • 3,542 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 6 Open issues
  • 7 Versions
  • 25 % Grown

The README.md

Request Routing Service

Service to route HTTP/REST requests to your own controller/actions., (*1)

Good to know: The routing is inspired by the way Flow's router works (read more)., (*2)

What does it do?

This extension lets you route requests like:, (*3)

http://localhost/routing/extension-key/my-demo/1234
http://localhost/routing/extension-key/my-demo/1234.json
http://localhost/routing/extension-key/my-demo/99

to any controller/action based on a YAML-based routing configuration. In this example, where 1234 and 99 will be mapped to some method argument (and converted to domain object if needed) and json will set the response format to json., (*4)

Sample Routing

The routing is stored as Configuration/Routes.yaml (or Configuration/Routes.yml) and looks like that, (*5)

-
  name: 'Demo action with a parameter in a given format (JSON, ...)'
  uriPattern: 'my-demo/{value}.{@format}'
  defaults:
    '@package':    'MyVendor.ExtensionKey'
    '@plugin':     'API'
    '@controller': 'Dummy'
    '@action':     'demo'
-
  name: 'Demo action with a parameter'
  uriPattern: 'my-demo/{value}'
  defaults:
    '@package':    'MyVendor.ExtensionKey'
    '@plugin':     'API'
    '@controller': 'Dummy'
    '@action':     'demo'

The name of the route is sent as additional header in the response:, (*6)

Additional HTTP header "X-Causal-Routing-Route", (*7)

Installation

  1. Install extension with packagist:, (*8)

    composer req causal/routing
    
  2. Go to Extension Manager and activate extension routing, (*9)

  3. Add a rewrite rule to your .htaccess:, (*10)

    RewriteRule ^routing/(.*)$ /index.php?eID=routing&route=$1 [QSA,L]
    

    or, if you are using Nginx:, (*11)

    rewrite ^/routing/(.*)$ /index.php?eID=routing&route=$1 last;
    

This will have the effect of using this extension for handling requests starting with routing/., (*12)

Tip: If you need to support localization (&L=<some-language-uid>), then you should change the suggesting routing above to include the root page uid of your website (&id=<some-uid>). This is needed because localization mode and default language may differ in complex environments and thus cannot be inferred., (*13)

Read more in the manual., (*14)

Compatibility with TYPO3 v8

Since change 78002, you need to adapt your TypoScript so that cHash is not required:, (*15)

plugin.tx_<yourext> {
    features {
        requireCHashArgumentForActionArguments = 0
    }
}

The Versions

25/01 2018

dev-master

9999999-dev https://github.com/xperseguers/t3ext-routing

Service to route HTTP/REST requests to your own controller/actions.

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

 

rest routing web service typo3 cms http request

04/12 2017

0.5.0

0.5.0.0 https://github.com/xperseguers/t3ext-routing

Service to route HTTP/REST requests to your own controller/actions.

  Sources   Download

GPL-2.0+

The Requires

 

rest routing web service typo3 cms http request

16/10 2017

dev-bugfix/17-camelcase

dev-bugfix/17-camelcase https://github.com/xperseguers/t3ext-routing

Service to route HTTP/REST requests to your own controller/actions.

  Sources   Download

GPL-2.0+

The Requires

 

rest routing web service typo3 cms http request

10/11 2016

dev-psr2

dev-psr2 https://github.com/xperseguers/t3ext-routing

Service to route HTTP/REST requests to your own controller/actions.

  Sources   Download

GPL-2.0+

The Requires

 

rest routing web service typo3 cms http request

22/09 2016

0.4.0

0.4.0.0 https://github.com/xperseguers/t3ext-routing

Service to route HTTP/REST requests to your own controller/actions.

  Sources   Download

GPL-2.0+

The Requires

 

rest routing web service typo3 cms http request

16/10 2015

0.3.0

0.3.0.0 https://github.com/xperseguers/t3ext-routing

Service to route HTTP/REST requests to your own controller/actions.

  Sources   Download

GPL-2.0+

The Requires

 

rest routing web service typo3 cms http request

18/12 2014

0.2.0

0.2.0.0 https://github.com/xperseguers/t3ext-routing

Service to route HTTP/REST requests to your own controller/actions.

  Sources   Download

GPL-2.0+

The Requires

 

rest routing web service typo3 cms http request