From 5eb162844b4d956acb9ed09b0105570f480145a1 Mon Sep 17 00:00:00 2001 From: bim-g <ibmussafb@gmail.com> Date: Thu, 25 Apr 2024 21:53:17 +0200 Subject: [PATCH] [ENH] introduce http request module --- src/Core/Http/Request.php | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/Core/Http/Request.php diff --git a/src/Core/Http/Request.php b/src/Core/Http/Request.php new file mode 100644 index 0000000..4891d41 --- /dev/null +++ b/src/Core/Http/Request.php @@ -0,0 +1,45 @@ +<?php +/* + * Copyright (c) 2024. Wepesi Dev Framework + */ + +namespace Wepesi\Core\Http; + +class Request +{ + public string $uri; + public string $method; + public array $get; + public array $post; + public array $files; + public array $cookie; + public array $server; + + public function __construct(string $uri, + string $method, + array $get, + array $post, + array $files, + array $cookie, + array $server) + { + $this->server = $server; + $this->cookie = $cookie; + $this->files = $files; + $this->post = $post; + $this->get = $get; + $this->method = $method; + $this->uri = $uri; + } + + public static function createFromGlobals(): Request + { + return new static($_SERVER['REQUEST_URI'], + $_SERVER['REQUEST_METHOD'], + $_GET, + $_POST, + $_FILES, + $_COOKIE, + $_SERVER); + } +}