final-gene/uri-template-module

Build URI templates from ZF2 routes

1.2.0 2016-03-23 17:12 UTC

This package is auto-updated.

Last update: 2024-12-10 23:48:01 UTC


README

Installation

Configure Composer

$ composer require "final-gene/uri-template-module"

Load module

Add FinalGene\UriTemplateModule to your project's application-config modules key

Usage

Retrieve the service from the service manager

<?php
$uriTemplateService = $serviceManager->get('FinalGene\UriTemplateModule\UriTemplateService')

Use the UriTemplateService via it's public methods

getFromRoute($routeName)

This method takes a route-key (for example api/rest/foo/bar) and returns a string containing a templated uri.

getFromResource($resourceName)

This method works exactly like getFromRoute but it takes a zf-rest config-key (resource name) instead of a route-key (for example Vendor\Module\RestController).