I would recommend you stop working in simple PHP and just get the framework. I have TON questions from people asking "how to connect to mysql", "How to upload a file in PHP" ...
All the time that I constantly think about, if you used the framework, you will not need to ask, since most support active queries that do not even require SQL knowledge to work, you do things like pseudo SQL, this creates a connection (elimination troubleshooting / debugging) for your requests.
Personally, I use codeigniter (excellent documentation, small footprint and easy to use). So you can take a look at this, it supports sparks , which makes receiving plugins even easier.
Jakub source share