You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+16-15
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,4 @@
1
-
# PHP Router : A versatile and efficient PHP routing solution designed to streamline route management within PHP applications.
2
-
3
-
[](https://packagist.org/packages/devcoder-xyz/php-router)[](https://packagist.org/packages/devcoder-xyz/php-router)[](https://packagist.org/packages/devcoder-xyz/php-router)[](https://packagist.org/packages/devcoder-xyz/php-router)[](https://packagist.org/packages/devcoder-xyz/php-router)
4
-
5
-
## Description
1
+
# PHP Router
6
2
7
3
PHP Router is a simple and efficient routing library designed for PHP applications. It provides a straightforward way to define routes, handle HTTP requests, and generate URLs. Built with PSR-7 message implementation in mind, it seamlessly integrates with PHP applications.
8
4
@@ -13,7 +9,7 @@ You can install PHP Router via Composer. Just run:
13
9
14
10
### Composer Require
15
11
```
16
-
composer require devcoder-xyz/php-router
12
+
composer require phpdevcommunity/php-router
17
13
```
18
14
19
15
## Requirements
@@ -81,13 +77,13 @@ class ArticleController {
81
77
```php
82
78
// Define your routes
83
79
$routes = [
84
-
new \DevCoder\Route('home_page', '/', [IndexController::class]),
85
-
new \DevCoder\Route('api_articles_collection', '/api/articles', [ArticleController::class, 'getAll']),
86
-
new \DevCoder\Route('api_articles', '/api/articles/{id}', [ArticleController::class, 'get']),
80
+
new \PhpDevCommunity\Route('home_page', '/', [IndexController::class]),
81
+
new \PhpDevCommunity\Route('api_articles_collection', '/api/articles', [ArticleController::class, 'getAll']),
82
+
new \PhpDevCommunity\Route('api_articles', '/api/articles/{id}', [ArticleController::class, 'get']),
87
83
];
88
84
89
85
// Initialize the router
90
-
$router = new \DevCoder\Router($routes, 'http://localhost');
86
+
$router = new \PhpDevCommunity\Router($routes, 'http://localhost');
Routes can be defined using the `Route` class provided by PHP Router. You can specify HTTP methods, attribute constraints, and handler methods for each route.
128
124
129
125
```php
130
-
$route = new \DevCoder\Route('api_articles_post', '/api/articles', [ArticleController::class, 'post'], ['POST']);
131
-
$route = new \DevCoder\Route('api_articles_put', '/api/articles/{id}', [ArticleController::class, 'put'], ['PUT']);
126
+
$route = new \PhpDevCommunity\Route('api_articles_post', '/api/articles', [ArticleController::class, 'post'], ['POST']);
127
+
$route = new \PhpDevCommunity\Route('api_articles_put', '/api/articles/{id}', [ArticleController::class, 'put'], ['PUT']);
0 commit comments