Advice needed from PHP/Cake PHP expert
Now, given how new I am, I'm rather lost as to how I get started. Down the road, I want to use MVC framework so that I help myself be disciplined in 开发者_StackOverflow社区the way I build. However, I know basic knowledge of PHP and OOP PHP are required. So my question is this: what are the right steps to mastering Cake PHP? I don't want to skip critical phases of learning before learning to Cake PHP. At the same time, I don't want to spend more time than required learning PHP if I can learn it directly through Cake PHP knowledge.
Any advice would be appreciated.
IMHO you should be comfortable writing at least a basic app in clean standard procedural code before using a framework. That means mastering all the basic elements of the language like if
and switch
, loops, functions, local and global variables, etc. It also includes being comfortable with HTTP GET and POST, RESTfulness and how to persist information between page loads (Cookies, Sessions, URL params). A basic idea of Javascript and AJAX would help as well.
Good exercises might include:
- A page that outputs database contents and is paginatable, filterable and sortable by various fields.
- A shop checkout process or similar "wizard"-like page.
That's when you can pick up a framework, since most frameworks abstract exactly these kinds of tedious things away from you. Especially Cake has a lot of automagic built in, which will leave you hopelessly confused if something goes wrong and you have no knowledge of the above mentioned. To start with OOP, you might want to try something like Zend first, which is a lot more transparent in how objects are used.
Deceze gives good advice, though I disagree that REST is a core concept for learning PHP. You can author a perfectly successful web app that isn't using the concept at all, and I don't think that you'd be hurt by learning it along with a framework.
The rest of his advice is good, however, and, so that you aren't out there on your own just crawling the web, I heartily recommend PHP and MySQL for Dynamic Websites by Larry Ulman. It won't teach you (much) about OOP, but it will give you a very solid foundation in PHP and MySQL, as well as how the two play together. More importantly, you'll cover a lot of core programming concepts applied to practical examples in PHP. This book was fundamental in my development as a programmer, providing baby steps and advanced techniques that made it a lot easier for me to digest more complex topics later on.
For a start, use the Cookbook
Although, I'd strongly suggest getting familiar with PHP itself first - any introductory level PHP book should suffice.
This one was by far the most useful for me
Build Your Own Database Driven Web Site Using PHP & MySQL, 4th Edition http://www.sitepoint.com/books/phpmysql4/
It went through all the basics in a very logical way, and then challenged you to take some first steps on your own.
After reading this book, I'm at the same point. Whats the next step to understanding OOP, and implementing a framework like Cakephp...
精彩评论