PHP code example of fatkulnurk / microframework

1. Go to this page and download the library: Download fatkulnurk/microframework 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/ */

    

fatkulnurk / microframework example snippets

`
use Fatkulnurk\Microframework\Routing\RouteCollector;

return function (RouteCollector $r) {
    $r->addRoute('GET', '/tes-json', function ($args) {
        $data = [
            'biodata' => [
                'nama' => 'fatkul nur koirudin',
                'ttl' => 'Lamongan, 18 Januari 1999',
                'alamat' => [
                    'desa' => 'Desa Ngambeg',
                    'kecamatan' => 'Kecamatan Pucuk',
                    'kabupaten' => 'Kabupaten Lamongan'
                ],
                'email' => '[email protected]',
                'hoby' => [
                    'memancing',
                    'belajar hal baru'
                ]
            ]
        ];

        return Response::getInstance()
            ->withXml($data);
    });
};

`
    $r->addRoute('GET', '/', function ($args) {
        return Response::getInstance()
            ->withView('index', [
                'name' => 'fatkul nur k',
                'birthday' => '18 januari 1999'
            ]);
    });
`
class Coba {
    public function index()
    {
        echo "Hello World";
    }
}