-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forward slash not require if setting $namespace in Router
- Loading branch information
Showing
11 changed files
with
189 additions
and
8 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
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
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
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
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
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,23 @@ | ||
<?php | ||
|
||
namespace Rougin\Slytherin\Sample\Handlers\Parsed; | ||
|
||
use Interop\Http\ServerMiddleware\DelegateInterface; | ||
use Interop\Http\ServerMiddleware\MiddlewareInterface; | ||
use Psr\Http\Message\ServerRequestInterface; | ||
|
||
/** | ||
* @package Slytherin | ||
* @author Rougin Gutib <rougingutib@gmail.com> | ||
*/ | ||
class Response implements MiddlewareInterface | ||
{ | ||
public function process(ServerRequestInterface $request, DelegateInterface $delegate) | ||
{ | ||
$response = $delegate->process($request); | ||
|
||
$response->getBody()->write('From middleware!'); | ||
|
||
return $response; | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
|
||
namespace Rougin\Slytherin\Sample\Packages; | ||
|
||
use Rougin\Slytherin\Application; | ||
use Rougin\Slytherin\Container\ContainerInterface; | ||
use Rougin\Slytherin\Integration\Configuration; | ||
use Rougin\Slytherin\Integration\IntegrationInterface; | ||
use Rougin\Slytherin\Sample\Retuor; | ||
|
||
/** | ||
* @package Slytherin | ||
* @author Rougin Gutib <rougingutib@gmail.com> | ||
*/ | ||
class SamplePackage implements IntegrationInterface | ||
{ | ||
public function define(ContainerInterface $container, Configuration $config) | ||
{ | ||
// Sets the default timezone ------------ | ||
$timezone = $config->get('app.timezone'); | ||
|
||
date_default_timezone_set($timezone); | ||
// -------------------------------------- | ||
|
||
/** @var \Rougin\Slytherin\Routing\RouterInterface */ | ||
$router = $container->get(Application::ROUTER); | ||
|
||
// Merge new routes to existing --- | ||
$new = new Retuor; | ||
|
||
$router->merge($new->routes()); | ||
// -------------------------------- | ||
|
||
$container->set(Application::ROUTER, $router); | ||
|
||
return $container; | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace Rougin\Slytherin\Sample; | ||
|
||
use Rougin\Slytherin\Routing\Router; | ||
|
||
/** | ||
* @package Slytherin | ||
* @author Rougin Gutib <rougingutib@gmail.com> | ||
*/ | ||
class Retuor extends Router | ||
{ | ||
protected $namespace = 'Rougin\Slytherin\Sample\Routes'; | ||
|
||
public function routes($parsed = false) | ||
{ | ||
$this->get('/world', 'Hello@world'); | ||
|
||
return parent::routes($parsed); | ||
} | ||
} |
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
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
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