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 8569637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:22:56+00:00 2026-06-11T18:22:56+00:00

I am looking to create a plugin manager like program which starts a loop

  • 0

I am looking to create a plugin manager like program which starts a loop that searches for .php files in the ‘plugins’ folder. I need this to somehow run a function called main() in each file which will then run other functions. How could i accomplish this without the other main() functions clashing and would there be any better alternative?

  • 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-06-11T18:22:58+00:00Added an answer on June 11, 2026 at 6:22 pm

    If you want to use functions then you can namespace them. But for something like this id use classes. for example each plugin might have a PluginConfiguration class which could either be namespaced like PluginName\PluginConfiguration or faked like PluginName_PluginConfiguration.

    Then you could jsut instatiate these classes and invoke whatever for example:

    class MyCool_Plugin implements PluginInterface {
    
      // note the interface wouldnt be absolutely necessary, 
      // but making an interface or abstract class for this would be a good idea
      // that way you can enforce a contractual API on the configuration classes
    
      public function __construct() {
         // do whatever here
      }
    
      public function main() {
         // do whatever here
      }
    }
    

    UPDATE:

    By the way, what would ‘PluginInterface’ include?

    Well an interface defines all methods (functions) a class must implement. You can use it to enforce a minimum API on any class the implements that interface. From your description this would be the method main although during development you may find that you need/want to add more.

    Interface PluginInterface {
    
       public function main();
    
    }
    

    You can also use type hinting to enforce a specific method signature. For example lets say you always want to inject the Application instance thats loading the plugin into the plugin itself so it can register things or set up additional stuff. In that case you might do:

    Interface PluginInterface {
    
       public function main(Application $app);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to create a windows program that doesn't require any environmental dependencies (like
I am looking to create an effect like that which is used on The
Im looking to create a control that would look like comic baloon. In WPF
I am looking for a plugin that helps developers create multithreaded network applications that
I am looking to create an easy java script plugin for my site that
I need to create a WordPress plugin that calls a PHP function when a
I'm looking for a jQuery plugin, which could create a flyout of a container
I'm looking to create the storyboard idea that oDesk uses on http://www.odesk.com/w/odesk_story I like
im looking for a small plugin which let me create formated javadoc. at the
I was looking at http://docs.jquery.com/Plugins/Authoring#Defaults_and_Options to create a simple plugin for jQuery. Following the

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.