Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Commit 05aded3

Browse files
committed
Simple demo content application
1 parent 85e13b6 commit 05aded3

26 files changed

+330
-47
lines changed

app/resources/view/index.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
<?php
2+
/** @var Simples\Template\View $this */
23

3-
/** @var Simples\Core\Template\View $this */
4-
4+
$this->extend('layout/basic/html.php', 'body');
55
?>
6-
<html>
7-
<head>
8-
<title><?php out(config('app.name')); ?></title>
9-
</head>
10-
<body>
11-
<div style="text-align: center;">
12-
Vamos falar de PHP?
6+
<div class="flex-center position-reference full-height">
7+
<div class="content">
8+
<img src="<?php $this->image('logo.png'); ?>" class="logo" alt="building">
9+
<hr>
10+
<div class="title">
11+
Simples
12+
</div>
13+
<hr>
14+
<div class="links">
15+
<a href="https://docs.simples.cloud">Documentation</a>
16+
<a href="https://phpzm.rocks">phpZM</a>
17+
<a href="https://github.com/phpzm/simples">GitHub</a>
1318
</div>
14-
</body>
15-
</html>
19+
</div>
20+
</div>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
/** @var Simples\Template\View $this */
3+
?>
4+
<body>
5+
<?php
6+
$this->grant('body');
7+
?>
8+
</body>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/** @var Simples\Template\View $this */
3+
?>
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="format-detection" content="telephone=no">
7+
<meta name="msapplication-tap-highlight" content="no">
8+
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
9+
<meta http-equiv="cache-control" content="max-age=0"/>
10+
<meta http-equiv="cache-control" content="no-cache"/>
11+
<meta http-equiv="expires" content="0"/>
12+
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT"/>
13+
<meta http-equiv="pragma" content="no-cache"/>
14+
15+
<title><?php out(config('app.name')); ?></title>
16+
17+
<link rel="apple-touch-icon" sizes="180x180" href="/assets/images/favicon/apple-touch-icon.png">
18+
<link rel="icon" type="image/png" href="/assets/images/favicon/favicon-32x32.png" sizes="32x32">
19+
<link rel="icon" type="image/png" href="/assets/images/favicon/favicon-16x16.png" sizes="16x16">
20+
<link rel="manifest" href="/assets/images/favicon/manifest.json">
21+
<link rel="mask-icon" href="/assets/images/favicon/safari-pinned-tab.svg" color="#318dce">
22+
23+
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
24+
<link href="<?php $this->style('style.css') ?>" rel="stylesheet" type="text/css">
25+
26+
<meta name="theme-color" content="#8bbcff">
27+
</head>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
/** @var Simples\Template\View $this */
3+
?>
4+
<!DOCTYPE html>
5+
<html>
6+
<?php
7+
$this->append('layout/basic/head.php');
8+
$this->append('layout/basic/body.php');
9+
?>
10+
</html>

app/resources/view/whoops.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
/** @var Simples\Template\View $this */
3+
4+
$this->extend('layout/basic/html.php', 'body');
5+
?>
6+
<div class="flex-center position-reference full-height">
7+
<img src="<?php $this->image('building.png'); ?>" alt="building">
8+
</div>

app/routes/index.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
<?php
22

3-
use Simples\Core\Kernel\HttpHandler;
4-
use Simples\Core\Route\Router;
3+
use App\Controller\View;
4+
use Simples\Route\Router;
55

66
/**
77
* @param Router $router
88
*/
99
return function (Router $router) {
1010

11-
// welcome
12-
$router->get('/', function () {
13-
/** @var HttpHandler $this */
14-
return $this->view('index.php');
15-
});
11+
// home
12+
$router->get('/',[View::class, 'home']);
1613

1714
// whoops, not found
18-
$router->otherWise('*', function () {
19-
return 'Whoops!' . PHP_EOL;
20-
});
15+
$router->otherWise('*', View::class);
2116
};

app/src/Controller/View.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace App\Controller;
4+
5+
use Simples\Controller\ViewController;
6+
7+
/**
8+
* Class View
9+
* @package App
10+
*/
11+
class View extends ViewController
12+
{
13+
/**
14+
* @return \Simples\Http\Response
15+
*/
16+
public function home()
17+
{
18+
return $this->view('index.php');
19+
}
20+
21+
/**
22+
* @return \Simples\Http\Response
23+
*/
24+
function __invoke()
25+
{
26+
return $this->view('whoops.php');
27+
}
28+
29+
}

composer.json

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
{
2-
"name": "phpzm/simples",
3-
"type": "project",
4-
"minimum-stability": "dev",
5-
"version": "0.1.0",
6-
"license": "",
7-
"authors": [
8-
{
9-
"name": "William",
10-
"email": "[email protected]"
11-
}
12-
],
13-
"require": {
14-
"phpzm/core": "^1.0.0"
15-
},
16-
"autoload": {
17-
"psr-4": {
18-
"App\\": "app/src/"
19-
}
20-
},
21-
"scripts": {
2+
"name": "phpzm/simples",
3+
"type": "project",
4+
"minimum-stability": "dev",
5+
"version": "0.1.0",
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "William",
10+
"email": "[email protected]"
2211
}
12+
],
13+
"require": {
14+
"phpzm/core": "^1.0.0"
15+
},
16+
"autoload": {
17+
"psr-4": {
18+
"App\\": "app/src/"
19+
}
20+
},
21+
"scripts": {
22+
"serve": "php -S localhost:8080 -t public/"
23+
}
2324
}

docker-compose.yml.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
volumes:
1010
- ./.docker/mysql:/var/lib/mysql
1111
ports:
12-
- "4000:3306"
12+
- "3306:3306"
1313
environment:
1414
- MYSQL_ROOT_PASSWORD=simples
1515
- MYSQL_DATABASE=simples
@@ -22,6 +22,6 @@ services:
2222
volumes:
2323
- .:/var/www/app
2424
ports:
25-
- "4010:8080"
25+
- "8080:8080"
2626
links:
2727
- mysql-simples

public/assets/favicon.ico

14.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)