PHP code example of paulao-dev / router-khan

1. Go to this page and download the library: Download paulao-dev/router-khan 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/ */

    

paulao-dev / router-khan example snippets


use App\Khan\Component\Router\Router;

Router\get('/home', function($req, $res){ 
        return "Home"; 
});
Router\post('/home', function($req, $res){ 
        return "Home"; 
});
Router\delete('/home', function($req, $res){ 
        return "Home"; 
});
Router\put('/home', function($req, $res){ 
        return "Home"; 
});
Router\patch('/home', function($req, $res){ 
        return "Home"; 
});
Router\temp('/home', function($req, $res){ 
        return "Home"; 
});
   
bash 
    # download zip
    $ git clone https://github.com/PaulaoDev/khan khan-project && cd khan-project && composer install
    
    # using cli khan
    $ php khan list
       
    # download usando cli khan
    $ php khan create khan-project && cd khan-project && composer install
    
    # instala dependencias e inicia o servidor
    $ composer install

    # so funciona em php 7
    $ php khan server
    
  
bash
  $ php khan list
  
bash
  # Iniciar o auto servidor
  $ php khan live