Jump to content

Recommended Posts

I have at least 5 classes in a file called library.php, this contains a few factory and static classes which are used quite often. I have a file called singletons.php which contains about 3 singletons inside that file. So it really depends on your coding style and how you want to have everything organized and structured. How you have it set up won't make your code any more/less object oriented.

Link to comment
https://forums.phpfreaks.com/topic/261282-oop-php/#findComment-1338958
Share on other sites

That also depends on how your script is set up. I have many library classes in one file that all have functions that can operate independantly.

So once I include the file basically all classes are autoloaded.

include_once( 'library.php' );
form_lib::function( );
user_lib::function( );
date_lib::function( );

 

Although the very beginning of this page:

http://php.net/manual/en/language.oop5.autoload.php

It says, "Many developers writing object-oriented applications create one PHP source file per-class definition".

 

So really it's up to you. You can do things the way many other developers do them. Or you can find a way that perfectly suits you by creating code to handle these types of instances themselves.

Link to comment
https://forums.phpfreaks.com/topic/261282-oop-php/#findComment-1338964
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.