Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aasumitro
committed
Feb 5, 2018
0 parents
commit 2771645
Showing
195 changed files
with
18,888 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
RewriteEngine on | ||
RewriteCond %{REQUEST_FILENAME} !-d | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteRule . index.php [L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"require": { | ||
"slim/slim": "^3.0" | ||
}, | ||
|
||
"autoload": { | ||
"psr-4": { | ||
"App\\": "app" | ||
} | ||
} | ||
} |
Oops, something went wrong.