PHP code example of luminovang / luminova

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

    

luminovang / luminova example snippets


namespace App\Controllers\Http;

use Luminova\Base\Controller;
use Luminova\Attributes\Route;
use Luminova\Attributes\Prefix;

#[Prefix('/(:base)', exclude: ['api'])]
class MainController extends Controller
{
    #[Route('/', methods: ['GET'])]
    public function index(): int 
    {
        return $this->view('index');
    }
}

namespace App\Controllers\Http;

use Luminova\Base\Controller;

class MainController extends Controller
{
    public function index(): int
    {
        return $this->view('index');
    }
}

// /routes/web.php
$route->get('/', 'MainController::index');

// /routes/web.php
use Luminova\Routing\Router;
use function Luminova\Funcs\view;

$router->get('/', function (): int {
    return view('index');
});

return $this->view(
    string $template,           // Template name
    array $options = [],        // View options
    string $type = View::HTML,  // Template content type
    int $status = 200           // HTTP status code
);

return $this->tpl->view(
    string $template,           // Template name
    string $type = View::HTML   // Template content type
)->render(
    array $options = [],        // View options
    int $status = 200           // HTTP status code
);

use function Luminova\Funcs\view;

return view(
    string $template,           // Template name
    array $options = [],        // View options
    string $type = View::HTML,  // Template content type
    int $status = 200           // HTTP status code
);
bash
php novakit generate:key
bash
php novakit server
bash
php novakit sitemap
ini
feature.route.attributes = true
ini
feature.route.attributes = false