PHP code example of marcuwynu23 / narciso

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

    

marcuwynu23 / narciso example snippets



 Marcuwynu23\Narciso\Application;


$app = new Application();

$app->setViewPath(__DIR__ . '/views');
$app->handleSession();
$app->handleCORS();

$app->handleDatabase([
	'type' => 'mysql',
	'host' => 'localhost',
	'database' => 'northwind',
	'username' => 'user',
	'password' => 'user',
]);



$app->route('GET', '/', function () use ($app) {
	return $app->render('/home/index.view');
});



$app->route('GET', '/json', function () use ($app) {
	return $app->json(['message' => 'Hello World']);
});