Skip to content

Instantly share code, notes, and snippets.

@pvgomes
Created February 16, 2017 17:46
Show Gist options
  • Save pvgomes/d772948a8edb42145ffc613edf673a89 to your computer and use it in GitHub Desktop.
Save pvgomes/d772948a8edb42145ffc613edf673a89 to your computer and use it in GitHub Desktop.
Mock api - up -> php -S 0.0.0.0:80 mock.php
<?php
require __DIR__ . 'vendor/autoload.php';
error_reporting(-1);
ini_set('display_errors', '1');
$r3 = new Respect\Rest\Router;
$r3->get('/ping', function() {
return 'pong';
});
/**
* Customer login example
**/
$r3->post('/customer/login', function() {
$data = ['data' => strtoupper(uniqid())];
$response = json_encode($data);
return $response;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment