PHP code example of k7 / nette-rest-route

1. Go to this page and download the library: Download k7/nette-rest-route library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

k7 / nette-rest-route example snippets


use AdamStipak\RestRoute;

// $router is an instance of Nette\Application\Routers\RouteList  

// No parameters needed. Presenter name will be generated.
$router[] = new RestRoute;

// With module.
$router[] = new RestRoute('Api');

// With module and xml as a default format.
$router[] = new RestRoute('Api', 'xml');
/api/users?foo=bar&page=1

format = json
associations = array(
	users => 1
)
data = ""
query = array(0)

format = json
id = 1
associations = array(
	users => 1
	blogs => 2
)
data = ""
query = array(0)