Jump to content

General questions..php - Your personal experiences.


Ninjakreborn

Recommended Posts

After writing programs for awhile with a specific language you pick up a lot of misc code that you use for various purposes.  I originally used a framework structure which was customized. Which happened to be Codeignitor.  After awhile though I noticed some projects are better with code ignitor, some are better with cakephp, some are better with symphony, and sometimes even others are best for a given situation.  Not to mention if I am working on a 1 page app...something very simple I generally just attach it to a class and do it without a framework.  However I noticed throughout all of this (both with and without a framework) over time I end up using a lot of various code that could be easily ported to standard functions for all purposes.    I am thinking of the best way to "carry" these around.  I could just create me a standard class. And make ti a large class. It would be setup with all of my functions within the class and I could port them everywhere (the 1 page projects, or in mass applications that need frameworks I could still put it in as a custom calss and have all of my custom functions as well as the stuff that comes with that specific framework.

 

So..I am thinking of the best way to set this up.

I could either have:

1) A class that is one class that has all of my things in it (all of my functions).

2) A master class/loader that I use and carry around a folder of classes that contain myfunctions split up by category.  Then I can instantiate my master class and load my sub-classes as needed for various use purposes (without having to load all my functions on any one project).

Then if I need to use my list of classes for a third party framework I can easily attach my master class into teh framework and use it to load all of my sub-classes into the framework system (or I can build a way to auto-load all the classes when I need them to all auto-load).

 

How do you carry your stuff around?

 

This isn't just applicable for PHP. I noticed in C++ as well there are times when you have custom functions that are modifiable and easily imported into general functions. These as well are not always available in third party classes or in the default C++ classes.  This is also applicable in ASP, and ASP.net (with C#).  So..this is more of general theory and less PHP specific.

 

Also as a note, I noticed the new icons associated with phpfreaks.com, some of those are nice.

Link to comment
Share on other sites

I agree with Corbin -- each class should have its own file if you follow the pear/zend framework guidelines.  You could package these by putting them in a directory structure.  Take a look at what Zend framework did, because that's a great example of a framework that was also designed to be used as a library ala/carte.

Link to comment
Share on other sites

That's more of what I was planning on.  Setting up different files for different classes, then having an auto-loader and/or loader class so I can load the ones I want.  I will take a look at zend. That's one of the only frameworks so far I haven't really "used" so I will install it and take a look to see how it's structured for research purposes.

Link to comment
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.