Orientend Object OOP Software Help

I read about OOP on several websites and looked (SO, and it's hard for me to find any examples showing a decent example of a complete OOP-PHP application). They give examples using cars, but that does not resonate well with me regarding putting it into actual use one day.

Can someone show me a good complete OOP example that can be used in a real script on a site. I know I can ask a lot, but it really helps.

Or there is a diagram somewhere where real life relationships are shown between methods, classes, objects, constructors, etc.

I know that this is not easy to explain, but it will be very useful.

Thanks in advance

+3
source share
4 answers

What if you change the “car” to something more familiar on the Internet?

$post = new BlogPost();
$post->setTitle($_POST['title']);
$post->setBody($_POST['body']);
$post->setTags($_POST['tags']);
$post->save();

Same idea. You have a BlogPost class that encapsulates the presentation and manipulation of blog posts. It hides things like splitting comma-separated tag lists from the user into separate lines in the tag table when saving a message and just saving the message. You can switch from saving them as text files to saving them in a database without changing the entire code, as indicated above, where you read or write messages.

+4
source

Symfony Yii. , , .

+3

I think these books can be a good starting point.

PHP Objects, Templates, and Practices, Second Edition

http://www.apress.com/book/downloadfile/3872

PHP in action

http://www.manning.com/reiersol/

+1
source

Source: https://habr.com/ru/post/1790883/


All Articles