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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:27:02+00:00 2026-05-23T03:27:02+00:00

What It Is Here is what I’ve done so far: core/ controllers/ (contains the

  • 0

What It Is

Here is what I’ve done so far:

  • core/
    • controllers/ (contains the controllers used by the app)
    • models/ (contains the models used by the app)
    • views/ (contains the views used by the app)
    • base_controller.php (the controller every other extend)
    • base_model.php (the model every other extend)
  • vendors/
    • phprouter/ (a simple router class)
    • pimple/ (a simple DI container class)
  • configuration.php (contains all the app configuration)
  • index.php (includes the configuration, vendors, base model, base controller, sets the DI container up and route the request)

See the code here: http://pastebin.com/pxUpUvv6
Please note that the given code is just an example, therefore the controllers, models, views aren’t in place yet. Also, it may be buggy—as untested—, but it doesn’t matter right now.

Request Flow

  1. The client requests index.php.
  2. The configuration, vendors, base controller, base model are included.
  3. The DI container and the dependencies are initialized, we can now inject them anywhere.
  4. We map controllers to URL and the router does its job.
  5. The controller is fetched (although this is not in the example code, as noted above).
    • We do some stuff.
    • The method then calls ::call_model(), which includes the corresponding model from core/models/, and then calls the same method we’re using from the model class corresponding.
  6. The model is fetched.
    • More stuff.
    • The model then calls ::call_view()‘, which includes the corresponding view from core/views/.
  7. The view is fetched and render the page to the client.

FYI: Corresponding

Examples of controller, model, view which correspond:

  • Controller Controller_Products::list() at core/controllers/Controller_Products.php
  • Model Model_Products::list() as core/models/Model_Products.php
  • View at core/views/Model_Products_list.php

Issues Being Faced

Actually, I feel a bit uncomfortable with this structure. Dunno, it seems to be far from scalable, modulable…

  1. Does only the basic folder structure—core{, /controllers, /models/, /views}, vendors at the root—looks good to you?
  2. I feel like I should get __autoload() outside of index.php, which seems a little too big to me. If so, what about DI container?
  3. Maybe if I get to needing more than two external library, it should be better not to have them included one by one, manually? But how?
  4. Putting all the configuration in a file configuration.php at the root looks to me like old-fashioned PHP4. Thanks to the power of Pimple, I could embed this configuration directly into it but yet, where?
  5. I think the way I handle ::call_model() (core/base_controller.php) and ::call_view() (core/base_model.php) is a bit awkward. Would you agree? What’d be a simplified way to redo the whole thing?
  6. Considering all my issues, would it eventually be better for me to use a framework as Symfony?

If something isn’t clear, feel free to ask.
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. Editorial Team
    Editorial Team
    2026-05-23T03:27:03+00:00Added an answer on May 23, 2026 at 3:27 am
    1. Yes.
    2. You can use autoload and DI container together. There is example, how autoload can be used with naming convention. I recommend to use spl_autoload.
    3. With autoload you can remove all (or almost all) includes.
    4. In index.php, I guess.
    5. Yes, it’s wrong way. First of all, try to not use static methods. Also, models should have methods with descriptive names, not just ‘call me and I will do all what I can’. It’s more complex problem – you need to understand how Controller and Model should do their cooperation. As variant, read some books. Controller should call methods of Model, to get data for some situation. Model it’s not just place for code of controller. Different controllers can use different models. Models too can use another models.
    6. Answer to this question can not be objective 🙂
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the scenario: I'm writing an app that will watch for any changes
Here is what I am trying to achieve in PHP: I have this string:
Here is my code: <?php $variable1 = 00001; $variable2 = (sprintf('%04d', $variable1 + 1));
Here's the problem....I have three components...A Page that contains a User Control and a
Here is simple code <?php $var = Бензин Офиси А.С. также производит все типы
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote

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.