Hey all,
I'm sure some of you code some large projects in PHP (tens of thousands lines of code), and I'm sure you have all ran into the whole problem of everything ending up messy.
I have background in C/C++, so many things I do in PHP I realize would take a whole lot of work in C. I love PHP, I use it for everything because it has everything I need built into the language. I don't have to write very many functions to do string manipulation or worry about things like pointers or how the heck I'm going to get some data into an associative array. And for all those complex operations, PHP is amazingly fast being a scripting language. That's what I like about it.
There comes a point though when I want to make my applications use less memory, not compile each and every time somebody loads the page, and most importantly, clean. I realize there are solutions such as the Zend Optimizer and the Zend Encoder. Sure, those products are cool and so are the free solutions out there, but do they actually create a compiled version of that PHP script and then cache it in memory?
Now, if I could have all my "front-end" scripts cached in memory on a server, and have those front end scripts communicate with a permanent service or daemon - that would be cool. Why not have your service manage changing aspects of your application like maintain lists of information (like a list of people who are currently logged in...) and handle all of the functions like authorizing a username/password or whatever you want.
Does anybody think this idea is going over the edge or would it be better to just create a bunch of "library" files with functions or classes that interface with your data? I want to code something that can be scalable, fast, and clean with PHP. I think part of the problem is I'm trying to make PHP do what it was not intended to do, and that is be more like a programming language and less like a scripting language.
What do you guys do when you want to create a large application like this? What about separating PHP from the HTML, and how do you handle databases?
Anybody have any thoughts on this sort of thing?