[SOLVED] How to use codeigniter routes on a procedural style PHP website with a codeigniter folder structure?

Issue

This Content is from Stack Overflow. Question asked by Redhead

I have a website built with a folder structure exactly like code igniter which has this folders:

  • app (controllers/core/helpers/libraries/models/views/) etc.
  • assets
  • files
  • system (core/database/fonts/helpers/language/libraries)
  • themes (default)
  • vendor

Codeigniter uses routes via Router.php to map urls so the url looks clean, this means instead of using:

www.example.com/app/controllers/index.php

you just use

www.example.com/

and so on for the other folders, but codeigniter it’s object oriented, and this website is made in procedural style.

Is there a way I can reply that routes for my website?

Thanks



Solution

There are plenty of PHP routers plugins that you could use, among populars AltoRouter, FastRoute, Klein.php.


This Question was asked in StackOverflow by Redhead and Answered by b126 It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?