I have been developing a MVC framework using php 5.x.x for about six months now. I understand that it is viable to use existing frameworks for the sake of not reinventing the wheel. However the basic reasoning behind my choice to do this was to get a thorough understanding of how to work with PHP and harness its strengths. My MVC framework has matured nicely and I like the degree of control/flexibility I have given that the framework is my own.
Now my dilemma....
When I first designed the framework, I did not incorporate PHP namespaces. My directory structure looks something like this:
cfg
includes
..app
....controllers
....models
....views
..lib
....class
....libs
index.php
The directory ./lib/libs contains the page bootstrapping sequence as well as autoloading functions. The same directory contains a file - e.g. "functions.php" which contain generic functions. "userfuncs.php" contains functions for user registration, things like that.
The problem
This implementation is only half object-oriented. It's also very confusing for implementing namespaces.
The solution
The first thing I plan to do is to create a bootstrap object. This object will contain much, if not all of the code required for autoloading and bootstrapping so that code doesn't need to lie out in the open (in the global namespace).
What I'm super confused about is how to integrate namespaces for groups of functions - e.g. "userfuncs.php". Without using namespaces it makes a lot of sense to just include that file manually so you have access to those functions wherever you need them. Trying to add namespaces and make my app conform to OO standards has got me kind of confused.
In essence: What is the best way to code and access my groups of functions in a more OO fashion? They shouldn't be built into the controllers - nor should they be built into "model" objects.
I'm confused. Help! Let me know if I can clarify this in any way to better get my confusion across.
Thanks,