Webwide is the inclusive discussion community for web designers, developers & makers.

Whether you're an enthusiast, in training, or a seasoned pro – you'll fit right in at Webwide. Creating an account is fast, easy and completely free so you can start participating right away.

Read our Code of Conduct

Free Membership Benefits

  • Participate in hundreds of interesting discussions
  • Network with industry peers and make new connections
  • Show off your own projects and relevant content
  • Get help and feedback for your coding and designs
  • Buy and sell services and resources in the marketplace
  • Participate in our friendly community challenges
  • Earn trophies and work your way up our leaderboards
  • Enjoy exclusive Webwide member discounts and offers
  • ...and so much more!

object-oriented programming in php

Parifoot19

New member
Joined
Oct 29, 2019
Messages
10
Reaction score
4
Points
3
I often laziness when he knew to learn OOP and especially the OOP in php. Do you think it's really important to use OOP for your projects? Do you use it?
 

Gummibeer

Well-known member
Joined
Oct 5, 2019
Messages
651
Reaction score
503
Points
635
Age
26
Location
Hamburg, Germany
Local Time
Today, 12:19
Website
gummibeer.de
Never without. You won't accomplish any larger project without OOP.
A good entry for PHP OOP would be Laravel. Great docs, easy to learn and amazing community.

And even WordPress OOPs itself but limits itself by this "we want simple updates and support every dev" policy. 🤮
 
  • Like
Reactions: Adam

kgx

Member
Joined
Oct 19, 2019
Messages
4
Reaction score
8
Points
5
Location
London
Local Time
Today, 11:19
Website
www.linkedin.com
Yeah, always use OOP and as Gummibeer suggested, use a framework. This is true even for small personal projects. It makes life a lot easier.
 
  • Like
Reactions: Gummibeer

Adam

Mr. Webwide
Administrator
Joined
Sep 24, 2019
Messages
603
Reaction score
571
Points
665
Location
United Kingdom
Local Time
Today, 11:19
Pronouns
he/him
If the project calls for it! Not every simple script needs to be OOP. I think it makes it more sense for complex and growing projects. If it’s something I can do in less than 200 lines of code in a simpler way then no. A great thing about PHP is that it can be written in functional, OOP and procedural.

OOP doesn’t make good code on its own either, it’s possible to write good and bad code in every style.

It’s pretty widely accepted at this point that PHP standards are OOP and that the language is becoming more and more object-capable as the versions go on.
 

Gummibeer

Well-known member
Joined
Oct 5, 2019
Messages
651
Reaction score
503
Points
635
Age
26
Location
Hamburg, Germany
Local Time
Today, 12:19
Website
gummibeer.de
If the project calls for it! Not every simple script needs to be OOP.
Disagree here. EVERY of my projects starts with a composer.json and PSR-4 which requires OOP.
Let's take your procedural webwide helpers as an example: yes they work without OOP. But if you would use it you would be able to put them all together, use abstraction layers and unify common objects/code/data/calls. OOP isn't made to make your code shorter in total - this counts most times only for growing projects. But to make it more readable, prevent copy and paste and make it easier to test and definitely a lot more.