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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:50:14+00:00 2026-06-13T06:50:14+00:00

I’m trying to build a simple MVC framework to better understand certain concepts. The

  • 0

I’m trying to build a simple MVC framework to better understand certain concepts. The first thing that I thought would be important to address is a front controller that handles all of the requests for my applications.

Once I started to think about it, I wasn’t sure of the best way to load the classes that my application would be using. My current thought process is that my autoloader should be located in the front controller since every request utilizes it. Where do most frameworks typically put this? Looking through a few already built frameworks hasn’t helped me much as a lot of the functionality far exceeds what I need, complicating it so much that it’s hard to understand.

The class loader that I am trying to use can be found here https://gist.github.com/221634

Just trying to figure out how to appropriately build and organize a simple MVC framework.

  • 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-13T06:50:15+00:00Added an answer on June 13, 2026 at 6:50 am

    You should put it in your bootstrap file.

    This is how you can do this:

    1. Force every HTTP request to your front controller, index.php, app.php or how ever you want to call it.
    2. Front Controller can define some constants used in framework and then include your Bootstrap.php file. Bootstrap will boot up your application.
    3. Now, first thing in I do in Bootstrap is to register autoloading. This way I can easily get \System\Router\Router class, or \System\Router\Dispatcher class, you get the point.

    One more thing, you can even register your application Models folder with PSR0 class loader.
    So lets say that your Models folder looks like this:

    application/Models/
        - Entities
        - Services
            Email.php
            Cache.php
    

    From inside your controller you can easily get Models like this

    public function someController()
    {
        $email = new \Models\Services\Email();
        // Do stuff with email service
    }     
    

    So short answer to your question is that the best thing to have is first Front Controller that gives you some “wiggle” room, then from there you load your Bootstrap that boots up your app, and first thing in Bootstrap is to require your class loader, and register libraries you want to use through application.

    And then you can even register autoloading for your application Controllers and Models folder, and at the end of Bootstrap file when you are about to dispatch request you can ask for Controller like this:

    $app = new '\\Application\\Controllers\\' . $class;
    // Dispatch request with call_user_func_array or ReflectionMethod and ReflectionClass
    

    No need to require Controller class since its autoloaded, just provide it with correct namespace.

    Great question, hope this helps! Nice to see there are other guys playing around with their custome MVC 🙂

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am doing a simple coin flipping experiment for class that involves flipping a
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to create an if statement in PHP that prevents a single post
I'm making a simple page using Google Maps API 3. My first. One marker
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.