router intro
This commit is contained in:
parent
e65d23fd5c
commit
a139193280
2 changed files with 9 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
PHP already has a few things built in to make working with HTTP easier. For example there are the [superglobals](http://php.net/manual/en/language.variables.superglobals.php) that contain the request information.
|
||||
|
||||
These are good if you just want to get a quick and dirty script runnin. But if you want to write clean, maintanable, [SOLID](http://en.wikipedia.org/wiki/SOLID_%28object-oriented_design%29) code, then you will want a class with a nice object oriented interface that you can use in your application.
|
||||
These are good if you just want to get a small script up and running without much thought on maintenance. But if you want to write clean, maintanable, [SOLID](http://en.wikipedia.org/wiki/SOLID_%28object-oriented_design%29) code, then you will want a class with a nice object oriented interface that you can use in your application.
|
||||
|
||||
Once again, you don't have to reinvent the wheel and just install a package. I decided to write my own [HTTP component](https://github.com/PatrickLouys/http) because I did not like the existing components, but you don't have to do the same.
|
||||
|
||||
|
|
|
@ -2,4 +2,12 @@
|
|||
|
||||
### Router
|
||||
|
||||
With your current setup it does not matter what URL is used to access the application, it will always result in the same response. So let's fix that now.
|
||||
|
||||
I will use [FastRoute](https://github.com/nikic/FastRoute) in this tutorial. But as always, you can pick your own favorite package.
|
||||
|
||||
Alternative packages: [symfony/Routing](https://github.com/symfony/Routing), [Aura.Router](https://github.com/auraphp/Aura.Router), [fuelphp/routing](https://github.com/fuelphp/routing), [Klein](https://github.com/chriso/klein.php)
|
||||
|
||||
By now you know how to install composer packages, so I will leave that to you.
|
||||
|
||||
to be continued...
|
Loading…
Reference in a new issue