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

  • Home
  • SEARCH
  • 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 74537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:22:25+00:00 2026-05-10T20:22:25+00:00

I wrote a small PHP application that I’d like to distribute. I’m looking for

  • 0

I wrote a small PHP application that I’d like to distribute. I’m looking for best practices so that it can be installed on most webhosts with minimal hassle.

Briefly: It’s simple tool that lets people download files once they login with a password.

So my questions are:

1) How should I handle configuration values? I’m not using a database, so a configuration file seems appropriate. I know that other php apps (e.g. WordPress) use defines, but they are global and there is potential that the names will conflict. (Global variables also have the same problem, obviously.) I looked at the ‘ini’ file mechanism built into PHP. It only allows comments at the top – so you can’t annotate each setting easily – and you can’t validate syntax with ‘php -f’. Other options?

2) How to handle templating? The application needs to pump out a form. Possibly with an error message. (e.g. ‘Sorry, wrong password.’) I’ve have a class variable with the HTML form, but also allow an external template file to be used instead (specified in the config). I do some trivial search and replace – e.g. %SCRIPT% to the name of the script, %STATUS% to hold the error message. This feels a bit like reinventing the wheel, but including a templating system like Smarty is overkill. (Plus they may already have a templating system.) Other options?

3) i18n – There are only 3 message strings, and gettext doesn’t seem to be universally installed. Is it such a bad idea just to make these three strings parameters in the config file?

4) How to best integrate with other frameworks? My app is a single class. So, I thought I could just include a php script that showed how the class was called. It would be a starting point for people who had to integrate it into another framework, but also be fine as-is for those not interested in customizing. Reasonable?

5) GET/POST parameters – Is it bad form for a class to be looking at $_GET and $_POST? Should all values be passed into my class during construction?

Thanks.

  • 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. 2026-05-10T20:22:26+00:00Added an answer on May 10, 2026 at 8:22 pm

    Configuration

    You can use a php file like this:

    <?php return array(   'option1' =&gt; 'foobar',   'option2' =&gt; 123,   //and so on...   ); ?> 

    And in the main class just use:

    $config = (array) include 'path/to/config/file'; 

    And if you plan to mostly distribute your class as a component in other applications, then simply put config array/object as a parameter in your class’ constructor and leave the details to the user.

    Templating

    For such simple application the method your described should be enough. Remember that one can always extend your class and overload your outputting method with his own.

    I10N

    As mentioned before, for 3 variables anything more than storing them as config is just overkill.

    Integration

    Comment each public method (or even better also protected and private ones) with explanations what do they do and what parameters are needed. If you combine that with an example, it should be enough for most users.

    GET vs POST

    Your class uses passwords and you even think of sending them via GET? 😉 Think of browser history, referer headers etc – your users’ passwords would be visible there.

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

Sidebar

Ask A Question

Stats

  • Questions 64k
  • Answers 64k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The quickest way is: <mx:Image id='img' source='{imageTileList.selectedItem.strThumbnail}' /> The data… May 11, 2026 at 10:53 am
  • added an answer Wouldn't that be &quot; in xml? i.e. 'hi &quot;mom&quot; lol'… May 11, 2026 at 10:53 am
  • added an answer For your scenario, it may not be necessary to add… May 11, 2026 at 10:53 am

Related Questions

I wrote a small PHP application that I'd like to distribute. I'm looking for
I wrote a small PHP application several months ago that uses the WordPress XMLRPC
I wrote a small sample of code in C# to capture selected text from
I recently wrote a small tool to generate a class for each tier I
I wanted to write a small Rapid Serial Visual Presentation (RSVP) program for my
I want to write a small program that should print something like testing CPU...
I need to write a small program that can detect that it has been
As the title says, I need to write a small program to read data
I'm trying to write a small class library for a C++ course. I was
I would like to write a small program in C# which goes through my

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.