Skip to content

Commit c64b78e

Browse files
committed
Router entry, missing folders
Router for built-in php server
1 parent faa0f80 commit c64b78e

File tree

9 files changed

+38
-11
lines changed

9 files changed

+38
-11
lines changed

.gitignore

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea
22
vendor/
3+
dsl-clc.jar

composer.json

100644100755
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"name": "dsl-platform/dsl-skeleton",
3+
"description": "PHP skeleton application",
34
"license": "BSD-3-Clause",
45
"type": "project",
6+
"minimum-stability": "dev",
57
"require": {
68
"dsl-platform/dsl-admin-php": "dev-master"
79
},
@@ -11,6 +13,12 @@
1113
"post-root-package-install": "PhpDslAdmin\\Installer::install"
1214
},
1315
"autoload": {
14-
"psr-0": { "": "src/" }
16+
"psr-4": {
17+
"": [
18+
"src/",
19+
"Generated-PHP/",
20+
"Generated-PHP-UI/"
21+
]
22+
}
1523
}
1624
}

config/dev.php

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$app['twig.options'] = array(
1313
'cache' => false,
1414
);
15-
$client = new \NGS\Client\RestHttp('http://localhost:9012/', 'revenj', 'revenj');
15+
$client = new \NGS\Client\RestHttp('http://localhost:8999/', 'revenj', 'revenj');
1616
\NGS\Client\RestHttp::instance($client);
1717
$app['dsl.client'] = $app->share(function() use ($client) {
1818
return $client;

config/prod.php

100644100755
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
$app->register(new \Silex\Provider\ValidatorServiceProvider());
88
$app->register(new \Silex\Provider\TranslationServiceProvider());
99
$app->register(new \Silex\Provider\SessionServiceProvider());
10-
$app['message'] = $app->share(function() use ($app) {
11-
return new \NGS\Service\MessageService($app['session']);
12-
});
1310

1411
$app['dsl.source.forms'] = function() { return require __DIR__.'/../Generated-PHP-UI/ModulesForms.php'; };
1512
$app['ngs.form.typemap'] = $app->share(function() use ($app) {
@@ -53,7 +50,6 @@
5350

5451
$app['crud.controller'] = $app->share(function() use ($app) {
5552
$controller = new \PhpDslAdmin\CrudController($app);
56-
$controller->setTwigNamespace('');
5753
return $controller;
5854
});
5955
$crudProvider = new \PhpDslAdmin\CrudControllerProvider();

src/.gitignore

Whitespace-only changes.

templates/.gitignore

Whitespace-only changes.

var/logs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

web/index.php

100644100755
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
<?php
2-
32
require_once __DIR__.'/../vendor/autoload.php';
43

54
$app = new Silex\Application();
65

76
require __DIR__.'/../config/dev.php';
87

9-
$app->get('/', function() use ($app) {
10-
return $app['twig']->render('index.twig');
11-
});
12-
138
$app->run();

web/router.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
// router for PHP built-in web server, replaces rewrite rules
3+
4+
$staticAlias = realpath(__DIR__.'/../vendor/dsl-platform/dsl-admin-php/public');
5+
6+
if (isset($_SERVER['REQUEST_URI']))
7+
$uri = $_SERVER['REQUEST_URI'];
8+
9+
if (strpos($uri, '/static') === 0) {
10+
$path = realpath($staticAlias . $uri);
11+
if ($path === false || strpos($path, $staticAlias) !== 0)
12+
return http_response_code(404);
13+
14+
$ext = substr($path, strrpos($path, '.'));
15+
if ($ext === '.css')
16+
$mime = 'text/css';
17+
else if ($ext === '.js')
18+
$mime = 'text/javascript';
19+
if (isset($mime))
20+
header('Content-Type: '.$mime);
21+
22+
if (@readfile($path) === false)
23+
return http_response_code(404);
24+
}
25+
else
26+
require __DIR__.'/index.php';

0 commit comments

Comments
 (0)