Skip to content

Commit

Permalink
"first commit"
Browse files Browse the repository at this point in the history
  • Loading branch information
aasumitro committed Feb 5, 2018
0 parents commit 2771645
Show file tree
Hide file tree
Showing 195 changed files with 18,888 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .htaccess
@@ -0,0 +1,4 @@
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
4 changes: 4 additions & 0 deletions README.md
@@ -0,0 +1,4 @@
# slim-training
Play with slim micro framework.

- [Article 1 - Installation](https://asmith.my.id/blog/rest-service-dengan-slim-micro-framework-instalasi)
19 changes: 19 additions & 0 deletions app/Controllers/Controller.php
@@ -0,0 +1,19 @@
<?php

namespace App\Controllers;

class Controller {

protected $container;

public function __construct($container) {
$this->container = $container;
}

public function __get($property) {
if ($this->container{$property}) {
return $this->container->{$property};
}
}

}
14 changes: 14 additions & 0 deletions app/Controllers/TestController.php
@@ -0,0 +1,14 @@
<?php

namespace App\Controllers;

class TestController extends Controller {

public function index($request, $response) {

$response->getBody()->write("Hello Slim With Controller");
return $response;

}

}
Empty file added app/Models/Model.php
Empty file.
19 changes: 19 additions & 0 deletions app/routes.php
@@ -0,0 +1,19 @@
<?php

/*
|----------------------------------------------------
| Routing sytem |
|----------------------------------------------------
*/

/**
* Route version without controller (example)
* $app->get('/', function($request, $response){
* Menampilkan twig template
* return $this->view->render($response, 'home.twig');
* })
*
*/

//route view with controller
$app->get('/', 'TestController:index')->setName('Home');
34 changes: 34 additions & 0 deletions bootstrap/app.php
@@ -0,0 +1,34 @@
<?php

/*
|----------------------------------------------------
| Register The Auto Loader
|----------------------------------------------------
*/

require __DIR__ . ('/../vendor/autoload.php');

/*
|----------------------------------------------------
| Slim Framework Setting |
|----------------------------------------------------
*/

$settings = require __DIR__ . ('/../config/settings.php');
$app = new \Slim\App($settings);

/*
|----------------------------------------------------
| File dependencies |
|----------------------------------------------------
*/

require __DIR__ . ('/../config/dependencies.php');

/*
|----------------------------------------------------
| File Router |
|----------------------------------------------------
*/

require __DIR__ . ('/../app/routes.php');
11 changes: 11 additions & 0 deletions composer.json
@@ -0,0 +1,11 @@
{
"require": {
"slim/slim": "^3.0"
},

"autoload": {
"psr-4": {
"App\\": "app"
}
}
}

0 comments on commit 2771645

Please sign in to comment.