Skip to content

Commit a13dda6

Browse files
committed
New Http class added instead of Url, Request and Response classes
1 parent fc5ab35 commit a13dda6

File tree

7 files changed

+56
-287
lines changed

7 files changed

+56
-287
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v1.1.0, 2018-04-07
2+
* PHP7 Support Added
3+
* New Http class added instead of Url, Request and Response classes
4+
15
# v1.0.2, 2015-10-27
26
* Added Composer Support
37
* Documentation updates

Http.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,13 @@ public static function getUriSegment(int $segment) : string
261261
/**
262262
* Returns whether this is an ajax request or not
263263
*
264-
* if (Http::isAjax()) {
264+
* if (Http::isAjaxRequest()) {
265265
* // do something...
266266
* }
267267
*
268268
* @return boolean
269269
*/
270-
public static function isAjax() : bool
270+
public static function isAjaxRequest() : bool
271271
{
272272
return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest';
273273
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Force
3+
Copyright (c) 2018 Flextype Components
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,71 @@
11
# Http
2-
Response and Request class
2+
![version](https://img.shields.io/badge/version-1.1.0-brightgreen.svg?style=flat-square "Version")
3+
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/flextype-components/http/blob/master/LICENSE)
34

5+
Simple Http Component to work with Http request, response and urls.
46

5-
## Response
6-
7-
### Set header status
8-
```
9-
Response::status(404);
7+
Set header status
8+
```php
9+
Http::setResponseStatus(404);
1010
```
1111

12-
## Request
13-
14-
### Redirects the browser to a page specified by the $url argument.
15-
```
16-
Request::redirect('test');
12+
Redirects the browser to a page specified by the url argument.
13+
```php
14+
Http::redirect('http://flextype.org');
1715
```
1816

19-
### Set one or multiple headers.
17+
Set one or multiple request headers.
18+
```php
19+
Http::setRequestHeaders('Location: http://flextype.org');
2020
```
21-
Request::setHeaders('Location: http://site.com/');
21+
22+
Get
23+
```php
24+
$action = Http::get('action');
2225
```
2326

24-
### Get
27+
Post
28+
```php
29+
$username = Http::post('username');
2530
```
26-
$action = Request::get('action');
31+
32+
Returns whether this is an ajax request or not
33+
```php
34+
if (Http::isAjaxRequest()) {
35+
// do something...
36+
}
2737
```
2838

29-
### Post
39+
Terminate request
40+
```php
41+
Http::requestShutdown();
3042
```
31-
$login = Request::post('login');
43+
44+
45+
Gets the base URL
46+
```php
47+
echo Http::getBaseUrl();
3248
```
3349

34-
### Returns whether this is an ajax request or not
50+
Gets current URL
51+
```php
52+
echo Http::getCurrentUrl();
3553
```
36-
if (Request::isAjax()) {
37-
// do something...
38-
}
54+
55+
Get Uri String
56+
```php
57+
$uri_string = Http::getUriString();
3958
```
4059

41-
### Terminate request
60+
Get Uri Segments
61+
```php
62+
$uri_segments = Http::getUriSegments();
4263
```
43-
Request::shutdown();
64+
65+
Get Uri Segment
66+
```php
67+
$uri_segment = Http::getUriSegment(1);
4468
```
4569

4670
## License
47-
See [LICENSE](https://github.com/force-components/Http/blob/master/LICENSE)
71+
See [LICENSE](https://github.com/flextype-components/http/blob/master/LICENSE)

Request.php

Lines changed: 0 additions & 149 deletions
This file was deleted.

Response.php

Lines changed: 0 additions & 110 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "library",
55
"license": "MIT",
66
"homepage": "https://github.com/flextype-components/http",
7-
"description": "Simple Http Class",
7+
"description": "Simple Http Component",
88
"authors": [
99
{
1010
"name": "Sergey Romanenko",

0 commit comments

Comments
 (0)