PHP code example of angedelamort / php-sun-framework
1. Go to this page and download the library: Download angedelamort/php-sun-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/ */
angedelamort / php-sun-framework example snippets
$options = new SunAppConfig()->activateDebugBar(__DIR__ . '/generated', '/generated')->(...)
$app = new SunApp($options);
// Normal monolog stuff
$logger = new SunLogger('name');
$logger->info('Hello here!');
// To appear in the 'Message' section
$logger->message('Should appear in the message section');
`
--- app/controllers/HomeController.php ---
namespace sample\controllers;
use sunframework\route\IRoutable;
class HomeController implements IRoutable {
public function registerRoute($app) {
$app->get('/', function($request, $response, $args) {
return $this->view->render($response, 'test.twig', [
'user' => 'John Doe'
]);
});
}
}
class FinalState extends BaseState {
public function __construct() {
parent::__construct();
$mySimpleTransition = new Transition(NextState::name());
$this->addTransition($mySimpleTransition);
}
}