Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
Would it matter if I had a giant class behind the public_html that stored all my user functions? User functions meaning actions that users can perform on my website based on an access level.
Am I thinking about this the wrong way or is a better way to divide up the classes by department?
I believe it is just a matter of how you want to do it.
I have such a page that performs all the actions (not a class) and I have it inside the public_html folder. Of course throughout this page, there are checks inside of the action that makes sure the user has the appropriate permissions to perform the actions. My page that I have is around 60kb in size, and I don't notice any difference at all having it in one 'giant' page. In fact, it makes it easier for me to go and update the scripts since I have all the form actions in one area.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
You can store included files off root and it's recommended to do so in order to prevent the possibility of hackers running your code in ways you didn't intend.
Putting all those functions in one class wouldn't be so good. The functions themselves may be trying to do too much unless they are merely calling on other objects to which tasks are delegated. An accounting action such as "enter sale" might involve a whole range of domain objects, classes which save to database, and classes which create a final view - possibly a page which summarises the action taken or maybe a sales listing.
Ideally you want smaller classes which do just one thing. I would expect to have dozens to carry out an "enter sale" action (or almost any kind of action for that matter).
alvinphp wrote:If you are going to put everything in one big class then why even have a class? Just create an include file with all your functions in it.
Exactly! There is a famous anti-pattern called a God Class (aka "The Blob"). This one would certainly qualify as a minor diety.