PHP code example of nearbycreative / light-framework

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

    

nearbycreative / light-framework example snippets




$app = new \Light\App();
$route = $app->routes;

$route->get('/test', function() {
    return ['hello' => 'world'];
});

$route->get('/test/{slug}', function($slug) {
    return ['slug' => $slug];
});



namespace App\Controller;

/**
 * Test Controller
 *
 * @packaage App\Controller
 */
class Test extends \Light\Controller
{

    /**
     * Index
     */
    public function index()
    {
        return ['hello' => 'world'];
    }

}