Skip to content

Instantly share code, notes, and snippets.

@DQNEO
Created January 24, 2016 07:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DQNEO/e0f516a41e794488c0c5 to your computer and use it in GitHub Desktop.
Save DQNEO/e0f516a41e794488c0c5 to your computer and use it in GitHub Desktop.
MySymfony
<?php
namespace MySymfony;
class HttpKernel
{
public function handle(Request $req)
{
$name = $req->query('name');
$response = new Response('hello ' . $name);
return $response;
}
}
class Request
{
public function __construct($get)
{
$this->get = $get;
}
public function query($key)
{
return $this->get[$key];
}
}
class Response
{
public function __construct($msg)
{
$this->body = $msg;
}
public function send()
{
echo $this->body;
}
}
$kernel = new HttpKernel;
$request = new Request($_GET);
$response = $kernel->handle($request);
$response->send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment