1. Go to this page and download the library: Download dizatech/burp 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/ */
dizatech / burp example snippets
//catch /user/2 (GET)
Burp::get('^/user/(\d+)$', null, array('as'=>'user.show', function($id) {
//show user $id
}));
//catch /user (POST)
Burp::post('^/user$', null, array('as'=>'user.create', function() {
//create new user
}));
//catch /user/2 (PATCH)
Burp::patch('^/user/(\d+)$', null, array('as'=>'user.update', function($id) {
//save changes for user $id
}));
//catch /welcome (on any http method: GET, POST, ...)
Burp::any('^/welcome/(\w+)$', null, function($username) {
//say welcome $username!
}));
//catch /something?apikey=xxxx
Burp::get(null, 'apikey=(\w+)', array('as'=>'key', function($key) {
//check api key in query string..
}));
//will return: /currenturi?apikey=asda
Burp::linkRoute('key','asda')
Burp::dispatch();
//catch /user/2 (GET) and bind it to UserController class on show method
Burp::get('^/user/(\d+)$', null, array('as'=>'user.show', 'uses'=>'UsersController@show'));
#index.php
p;
//widget routing - fired when url is for example: /something/pg/2
Burp::get('pg/(\d+)', null, array('as'=>'page', function($page) {
echo "current page is page: $page<br>";
}));
//widget routing - fired when url is for example: /something?ord=-title
Burp::get(null, 'ord=(-?)(\w+)', array('as'=>'orderby', function($direction, $field) {
$direction = ($direction == '-') ? "descending" : "ascending";
echo "current sorting is on : $field ($direction)<br>";
}))->remove('page');
//strict route - fired when uri is "/" or "/pg/2", but not when is "/something/pag/2" ...
Burp::get('^/{page?}$', null, array('as'=>'home', function() {
echo '<hr>';
echo '<a href="'.Burp::linkRoute('page',1).'">page 1</a><br>';
echo '<a href="'.Burp::linkRoute('page',2).'">page 2</a><br>';
echo '<a href="'.Burp::linkRoute('orderby',array('','title')).'">sort title up</a><br>';
echo '<a href="'.Burp::linkRoute('orderby',array('-','label')).'">sort label down</a><br>';
echo '<hr>';
}));
//404 route - fired only if there are defined strict routes (i.e.: ^/$ or ^.*$)
//but all uncatched
Burp::missing(function() {
header("HTTP/1.0 404 Not Found");
echo '404 - Resource Not Found';
die;
});
//where all began
Burp::dispatch();