Half Blind Half Blind - 10 months ago 52
PHP Question

Diffrence between Simple Router like (CodeIgniter) and Restful Router (Slim Php)

I am a novice PHP coder. Have basic knowledge in php [Self taught]. Presently learning CodeIgniter. But recently checked Slim Php Framework. It has Restful Router.

Can any one please tell, what is difference between CodeIgniter Router and Slim Router. And which one is better?

Thanks in advance.


Codeiginiter maps your class and method to the url. This a easy way to build your mvc project. But in my opinion isn't a good way to build apps if you need more powerful, if anyone wants change urls you have a serious problem.

Slim 3 has a way to map an url to your own class. For example:

$app->get('/myownurl', MyController::class);

You can change it easily.

You could review routes docs: http://www.slimframework.com/docs/objects/router.html#how-to-create-routes