PHP code example of aalfiann / slim-jwt-skeleton

1. Go to this page and download the library: Download aalfiann/slim-jwt-skeleton 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/ */

    

aalfiann / slim-jwt-skeleton example snippets


use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

// Route for /my_app
$app->group('/my_app', function($app) {

    // Show index page
    // Try to open browser to http://yourdomain.com/my_app/
    $app->get('/', function (Request $request, Response $response) {
        $data = [
            'welcome' => 'Hello World, this is my_app index page.',
            'message' => 'This is my first app rest api with slim-jwt-skeleton.'
        ];
        return $response->withJson($data,200,JSON_PRETTY_PRINT);
    })->setName("/my_app/");

});