PHP Classes
elePHPant
Icontem

File: example/app/api/bootstrap.php

Recommend this page to a friend!
  Classes of Rafael Rodriguez  >  Div PHP Ways  >  example/app/api/bootstrap.php  >  Download  
File: example/app/api/bootstrap.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Div PHP Ways
Route HTTP requests to registered handlers
Author: By
Last change: url args feature & bugfixs
Date: 1 year ago
Size: 329 bytes
 

Contents

Class file image Download
<?php

#id = api
#listen = api
#listen = api/...

function users($data, $args)
{
    echo
'{"users": ["user1", "user2" ]}';
}

function
user($data, $args)
{
    echo
'{"name": "User ' . $args['id'] . '"}';
}

divWays::listen("/api/users", "api@users");
divWays::listen("/api/user/{id}", "api@user");
divWays::bootstrap("_url", "/api");