Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5948715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:08:52+00:00 2026-05-22T17:08:52+00:00

Since PHP < 5.3 doesn’t offer namespacing, I’m wondering what the best way to

  • 0

Since PHP < 5.3 doesn’t offer namespacing, I’m wondering what the best way to approach this situation is w/regards to WordPress:

I wrote a plugin, using some helper classes from another, non-WP application of mine. The classes are pretty generic, for example one is named Tools. Another is named Pic, which is used to encapsulate all the functionality and data of an image. Additionally I have a base class from which all DB-related classes are derived. Altogether I have 5 classes, and as a plugin, it works great.

I then realized that I will write more plugins that would use these same helper classes. My options as I see them are:

  1. have plugin #2 require plugin #1 to be installed, and use the same helper classes (that’s OK from my perspective but I’d like to make these plugins available to all w/o any such restrictions)

  2. duplicate the helper functions into plugin #2 and give them different names (ie Plugin2_Tools, Plugin2_Pic, and similarly rename those in plugin #1 to Plugin1_Tools, etc…) I’m thinking this is the best way, though I could see having dozens of plugins all using the same base classes and helper classes and duplicating them would be a pain!

2a. I’m also thinking I should rename the classes and functions in any case so that they are more unique (EG MyPlugin_Tools….) so there is less chance of name duplication in the non-namespace PHP world.

Just curious if there is an established convention or best practice for this? I’m guessing #1 is good for private use and #2 is good for open source… Any suggestions appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:08:53+00:00Added an answer on May 22, 2026 at 5:08 pm

    For functions/classes you will be using across multiple functions you may want to consider appending your name or initials or company initials to the front. Then for plugin specific functions use a combination of the previous + the plugin name.

    Example:

    jrod_base_class;

    jrod_laser_plugin_class;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since PHP is a dynamic language what's the best way of checking to see
What is the best way to approach translating this code into Java? (the section
This kind of code would normally work in PHP, but since the scope is
PHP is somewhat crippled since it doesn't have return types (yet). I need my
This is the template language of Stacy (a super light HTML/PHP CMS that doesn't
Since PHP doesn't provide real arrays, I want to create an array class myself.
Since PHP has no custom-class type-casting, how would I go about doing the PHP
Since I'm not an Php programmer I have to ask you, I have to
Sessions in PHP seemed to have changed since the last time I used them,
I don't know how php.ini was configured since I don't have access to it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.