Hi, I'm building my CI structure. Is it a good practice to separate the logic in the controller? My goal is to make controller act like a router and just use the logic classes with namespace support.
Here is my build: https://github.com/marksagal/CodeIgniterPlus.git
- You will have to point your DocumentRoot to ./public
- You will have to manually create ./application/cache/views/
Autoload:
- CodeIgniter-minify
- Blade template engine
How to create logic? create a file in logic folder in Studlycase (Myclass.php). The class can be namespaced, then use your class by adding use yournamespace\Myclass in your controller and just instantiate it and its ready to be used.
e.g: ./application/logic/Store/Car.php = \Store\Car::myMethod()
(Convention: every Capital letter in class and filename considered another level of directory)
Please suggest ideas because I will be building a longterm project. I prefer the best practices.
Here is my build: https://github.com/marksagal/CodeIgniterPlus.git
- You will have to point your DocumentRoot to ./public
- You will have to manually create ./application/cache/views/
Autoload:
- CodeIgniter-minify
- Blade template engine
How to create logic? create a file in logic folder in Studlycase (Myclass.php). The class can be namespaced, then use your class by adding use yournamespace\Myclass in your controller and just instantiate it and its ready to be used.
e.g: ./application/logic/Store/Car.php = \Store\Car::myMethod()
(Convention: every Capital letter in class and filename considered another level of directory)
Please suggest ideas because I will be building a longterm project. I prefer the best practices.