Commit 8cf21970 authored by Jason Frisvold's avatar Jason Frisvold
Browse files

Composer file and test of slim framework for front end

parent 9fd6eda1
{
"require": {
"slim/slim": "*",
"slim/views": "*",
"illuminate/database": "*"
}
}
<?php
require 'vendor/autoload.php';
$app = new \Slim\Slim(array(
'view' => new \Slim\Views\Smarty(),
'debug' => true,
'log.enable' => true,
'log.path' => 'logs/',
'log.level' => 4,
'mode' => 'development'
));
$view = $app->view();
$view->parserDirectory = '/Users/XenoPhage/Sites/Smarty/libs';
$view->parserCompileDirectory = '/Users/XenoPhage/Sites/Smarty/skynet/templates_c';
$view->parserCacheDirectory = '/Users/XenoPhage/Sites/Smarty/skynet/cache';
$view->parserExtensions = array(
dirname(__FILE__) . '/libs',
);
// GET route
$app->get('/', function () use ($app) {
$smarty = $app->view()->getInstance();
$smarty->loadFilter("pre", 'whitespace_control');
$data = array(
'skynet_favicon' => '',
'skynet_stylesheet' => 'css/default.css',
'skynet_homepage' => '',
'skynet_version' => '1.0 Beta',
);
$app->render('index.tpl', $data);
});
// GET route
$app->get('/about', function () use ($app) {
$smarty = $app->view()->getInstance();
$smarty->loadFilter("pre", 'whitespace_control');
$data = array(
'skynet_favicon' => '',
'skynet_stylesheet' => 'css/default.css',
'skynet_homepage' => '',
'skynet_version' => '1.0 Beta',
'username' => 'guest',
);
$app->render('about.tpl', $data);
});
// GET route
$app->get('/another', function () use ($app) {
$app->render('another.tpl');
});
// POST route
$app->post(
'/post',
function () {
echo 'This is a POST route';
}
);
// PUT route
$app->put(
'/put',
function () {
echo 'This is a PUT route';
}
);
// PATCH route
$app->patch('/patch', function () {
echo 'This is a PATCH route';
});
// DELETE route
$app->delete(
'/delete',
function () {
echo 'This is a DELETE route';
}
);
/**
* Step 4: Run the Slim application
*
* This method should be called last. This executes the Slim application
* and returns the HTTP response to the HTTP client.
*/
$app->run();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment