Skip to content

Commit 31937f9

Browse files
committed
Merge branch 'main' of https://github.com/grephq/php-router into main
2 parents 739621a + 5a9cd21 commit 31937f9

File tree

1 file changed

+79
-79
lines changed

1 file changed

+79
-79
lines changed

README.md

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,79 @@
1-
# PHP Router
2-
[![Latest Stable Version](http://poser.pugx.org/grephq/php-router/v)](https://packagist.org/packages/grephq/php-router) [![Total Downloads](http://poser.pugx.org/grephq/php-router/downloads)](https://packagist.org/packages/grephq/php-router) [![Latest Unstable Version](http://poser.pugx.org/grephq/php-router/v/unstable)](https://packagist.org/packages/grephq/php-router) [![License](http://poser.pugx.org/grephq/php-router/license)](https://packagist.org/packages/grephq/php-router)
3-
4-
## Features
5-
- Static routes
6-
- Dynamic routes
7-
- Pass variables in the URI
8-
- Mulitiple HTTP methods
9-
- Custom error handling
10-
- Enable/Disable error reporting
11-
- Request logging
12-
13-
## Usage
14-
### Routes
15-
Routes are defined in ```app.php```
16-
```php
17-
$route->get('/users', function() {
18-
Index::get();
19-
});
20-
21-
$route->post('/user/<string:name>', function() {
22-
Index::post();
23-
});
24-
25-
$route->delete('/user/<int:id>', function() {
26-
Index::delete();
27-
});
28-
```
29-
30-
### Defining Controllers
31-
Controllers are defined in ```Controllers/```
32-
```php
33-
class User extends BaseController
34-
{
35-
public static function get()
36-
{
37-
render('index.php', array('title' => 'Index Page'));
38-
}
39-
40-
public static function post()
41-
{
42-
json(reqVar('name'), 200);
43-
}
44-
45-
public static function delete()
46-
{
47-
xml('Delete Request', 200);
48-
}
49-
}
50-
```
51-
52-
## Installation
53-
Via Git
54-
```bash
55-
git clone https://github.com/grephq/php-router.git
56-
```
57-
Via Composer
58-
```bash
59-
composer create-project grephq/php-router
60-
```
61-
62-
## Docs
63-
https://github.com/grephq/php-router/wiki
64-
65-
## Example
66-
https://github.com/grephq/php-router/wiki/Usage#example
67-
68-
## License
69-
70-
MIT License
71-
72-
Copyright (c) 2022 Olorunfemi-Ojo Tomiwa
73-
74-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
75-
76-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
77-
78-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
79-
1+
# PHP Router
2+
[![Latest Stable Version](http://poser.pugx.org/grephq/php-router/v)](https://packagist.org/packages/grephq/php-router) [![Total Downloads](http://poser.pugx.org/grephq/php-router/downloads)](https://packagist.org/packages/grephq/php-router) [![Latest Unstable Version](http://poser.pugx.org/grephq/php-router/v/unstable)](https://packagist.org/packages/grephq/php-router) [![License](http://poser.pugx.org/grephq/php-router/license)](https://packagist.org/packages/grephq/php-router)
3+
4+
## Features
5+
- Static routes
6+
- Dynamic routes
7+
- Pass variables in the URI
8+
- Multiple HTTP methods
9+
- Custom error handling
10+
- Enable/Disable error reporting
11+
- Request logging
12+
13+
## Usage
14+
### Routes
15+
Routes are defined in ```app.php```
16+
```php
17+
$route->get('/users', function() {
18+
Index::get();
19+
});
20+
21+
$route->post('/user/<string:name>', function() {
22+
Index::post();
23+
});
24+
25+
$route->delete('/user/<int:id>', function() {
26+
Index::delete();
27+
});
28+
```
29+
30+
### Defining Controllers
31+
Controllers are defined in ```Controllers/```
32+
```php
33+
class User extends BaseController
34+
{
35+
public static function get()
36+
{
37+
render('index.php', array('title' => 'Index Page'));
38+
}
39+
40+
public static function post()
41+
{
42+
json(reqVar('name'), 200);
43+
}
44+
45+
public static function delete()
46+
{
47+
xml('Delete Request', 200);
48+
}
49+
}
50+
```
51+
52+
## Installation
53+
Via Git
54+
```bash
55+
git clone https://github.com/grephq/php-router.git
56+
```
57+
Via Composer
58+
```bash
59+
composer create-project grephq/php-router
60+
```
61+
62+
## Docs
63+
https://github.com/grephq/php-router/wiki
64+
65+
## Example
66+
https://github.com/grephq/php-router/wiki/Usage#example
67+
68+
## License
69+
70+
MIT License
71+
72+
Copyright (c) 2022 Olorunfemi-Ojo Tomiwa
73+
74+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
75+
76+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
77+
78+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
79+

0 commit comments

Comments
 (0)