Skip to content
kaythinks edited this page Apr 12, 2020 · 1 revision

This routing system which has support for the following HTTP verbs namely, GET, POST, PUT,PATCH and DELETE. It also has support for dynamic routing e.g /test/{id} where the value of id can be anything.


public static function get(string $url, $controllerDatas)

This method is used for making GET requests, it can be accessed in the following ways,

             use Kaythinks\KayRoute\Router;

             Router::get('/','HomeController@index');
             
             OR 
             
             Router::get('/',function(){
                 echo "I am here";
             });

public static function post(string $url, $controllerDatas)

This method is used for making POST requests, it can be accessed in the following ways,

            use Kaythinks\KayRoute\Router;

            Router::post('/data','HomeController@postData');
             
             OR
             
             Router::post('/demo/{id}',function(){
                   echo $_REQUEST['id'];
             });

public static function put(string $url, $controllerDatas)

This method is for making PUT requests, it can be accessed in the following ways,

             use Kaythinks\KayRoute\Router;

             Router::put('/data/1','HomeController@postData');
             
             OR
             
             Router::put('/demo/{id}',function(){

                   //Input your logic here
             });

public static function patch(string $url, $controllerDatas)

This method is for making PATCH requests, it can be accessed in the following ways,

             use Kaythinks\KayRoute\Router;

             Router::patch('/data/1','HomeController@postData');
             
             OR
             
             Router::patch('/demo/{id}',function(){
                   //Input your logic here
             });

public static function delete(string $url, $controllerDatas)

This method is for making DELETE requests, it can be accessed in the following ways,

             use Kaythinks\KayRoute\Router;

             Router::delete('/data/1','HomeController@postData');
             
             OR
             
             Router::delete('/demo/{id}',function(){
                   //Input your logic here
             });

Clone this wiki locally