I'm looking for a simple PHP framework for a beginner :) Any recommendations?
Not Codeigniter. That's too much for me.
Thanks in advance.
I'm looking for a simple PHP framework for a beginner :) Any recommendations?
Not Codeigniter. That's too much for me.
Thanks in advance.
I think you should check out CakePHP at http://cakephp.org/
Cake essentially allows you to think about the views, controllers and models you need to use in your application and largely allows you to forget about the problems and time challenges developers face when starting a project.
It follows the MVC pattern http://en.wikipedia.org/wiki/Model-view-controller which will keep things simple for you as it separates stuff. Additionally the framework has plenty of documentation
The Simple PHP Framework may be of some interest.
The Simple PHP Framework is a pragmatic approach for developing websites with PHP 5. Our target audience is web design shops who need to get projects off the ground quickly and individual programmers who just don't care or need to use any one of the many large, cumbersome, MVC frameworks floating around.
Codeigniter is one of the simplest frameworks I've seen. Anything simpler, you might as well write direct php code.
Build your own?
I think a good minimalist php framework would consist of a front controller, a view class, an autoloader, and perhaps a router.
The front controller could be an index.php file in the document root. An .htaccess file would pass all requests (outside of existing resources like css, js, etc.) to index.php. The front controller would parse the url and dispatch to the correct php controller class and method. Add a router class, and you could optionally map specific url patterns to any controller you wish.
A view class could simply load a specified php view file and extract() an array variables passed to it. Alternatively, the view class could be a template engine like Smarty.
You'll eventually need helper and library classes. The Zend Framework or PEAR components could be used along with a custom autoloader function so you don't have to require component classes before instantiating them.
Store all your php files except the index.php front controller outside of the document root to avoid direct access.
This question is a bit like going to the hardware store and having a conversation like:
You: I'd like to buy some tools.
Staff Member: Ok, great. What are you building?
You: Don't know yet. But I'm sure I'll need some tools.
There is absolutely no point in solving a problem until you have a problem. Just code vanilla PHP until you decide some particular task is too hard/messy/etc and a framework will actually help you.
And, this may go against the "must-have-framework" crowd, but honestly I think for trivial tasks you're typically better rolling your own (I see logging in Java as a prime example of overcomplication and the merits of rolling your own).
I second CodeIgniter. It is simple, well documented and was instrumental in helping my understanding of the MVC style of programming. It doesn't require the use of the command line and it's conventions made a lot of sense to me. I believe it is definitely an excellent beginner's PHP framework.
Now with pros there are some cons. No built-in user authentication libraries (you can download plugins to fill that hole) and while obviously open source I just wasn't as thrilled about it's company backing and therefore intentions as I would of hoped.
CodeIgniter is definitely the place to start with PHP frameworks in my opinion.