I hope you will help me! =)
Since I work with PHP, I always code procedural. Why? The answer is simple. I don’t know how to work with objects etc.. But I want to! Really… =) I search the net and found this tutorial – Object Oriented Programming with PHP. So I read it, learned the syntax. A little bit experiment with given code. And I count it as learned! xD
Let me explain the problem. For example, I want to create users system. Before it was easy to do. I just create one file as HTML form. User input username and password. It’s sends to another file where I validate it. If all is OK then PHP writes a new entry to the database. Otherwise error is created. The same with sign in, just for entry – session variable created with user ID. And how to check if user is sign in? Just check for session variable. No problems. And the problem comes… With objects? How can I do it? What’s object (user, some validation?)? Where’re objects? And so on with stupid, even newbie questions… =(
Could everyone create little example for me? Really for newbie in this. I really want to learn. Thanks. =)
P.S. Sorry for my English, it’s not my native language. =P
This is an extreemly broad question. Youre asking us to give you a skeleton implementation of the core of an entire application! 🙂
Most of this also depends on how you want the architecture of your app. YOU have to create all these classes or use open source implementations of them, they are not built in to PHP. That is why most people use a framework that provides most of this base stuff.
However I wouldnt recommend jsumping directly to using a framework with your base level of knowledge. ID urge you to read up OOP patterns and concepts. This article while old gives a direct comparison of moving from procedural to OOP and walks you through creating a basic MVC framework of your own. Ther are lots of resources similar to this so i would google if i were you.
I dont know that i would use such a framework in production but the process of creating it and making soem personal apps with it is invaluable to learning. After you get some of the key concepts and patterns down then i would choose a framework thats got a lot of structure (in your case the more rigid the better, since youre just learning) and begin working with that.
While i dont personally use it because its not flexible enough I think i would recommend CakePHP in your case. Symfony might also be a good choice, but its extremely complex and if youre new to OOP you may lose your mind… Ditto for Zend 🙂
I would also recommend PHP Objects, Patterns, and Practice, Second Edition as a general reference book. Its similar to PoEAA but specific to php implementations and examples.