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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:31:00+00:00 2026-06-11T16:31:00+00:00

My MVC structure is following: – web — Classes — Loader.php — Core —

  • 0

My MVC structure is following:

- web
  -- Classes
    --- Loader.php
  -- Core
    --- Controller.php
    --- Model.php
    --- View.php
    --- Bootstrap.php
    --- DB.php
  -- Project
    --- Controllers (folder)
    --- Models (folder)
    --- Views (folder)

Now i have namespaces specified to each. For example i have

    namespace Classes; //for Loader.php
    namespace Core; //For Controller.php, Model.php etc...
    namespace Project\Controllers; //For Controllers inside Controllers folder etc...

My autoloader looks like this:

public static function Autoloader2($className) {
    $className = explode('\\', $className);
    $class = array_pop($className);
    $namespace = implode(DIRECTORY_SEPARATOR, $className);
    $file = $namespace . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';

   require $file;
}

and My main index.php uses

    spl_autoload_register( array('Loader', 'Autoloader2') );
    $app = new Core\Bootstrap();

when i open localhost/web/
i get the following error:

  Warning: require(Core/Project/Controllers/Index.php): failed to open stream: N

It seems it prepends Core/ to the requested file. Index.php is inside Project/Controllers and not Core/Project/Controllers. If i try to remove

  //namespace Core; from Bootstrap.php i get the following error
  Fatal error: Class 'Core\Bootstrap' not found 

Please help

  • 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-11T16:31:01+00:00Added an answer on June 11, 2026 at 4:31 pm

    You should use $app = \Core\Bootstrap();.

    The slash before the path is important, without it your namespace paths will be relative to each other.

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

Sidebar

Related Questions

I have the following project structure: base project (service layer, model) web project webservice
Say I have an application with the following structure. // ASP.NET MVC (Web Project)
I have created the following project structure for my new asp.net mvc project any
I recently received a project that contains multiple web applications with no MVC structure.
I am new to spring MVC. i have below project structure. Below are classes:
I have an .Net MVC 3 web application that has the following structure root
I have a new asp.net mvc 3 project with following structure: Views: /Home/Index.cshtml @{
My application has an MVC structure. Is it sufficient to only cache the model
I am new to .net MVC structure. I am trying to create Partial view
I want the following structure in my ASP.NET MVC solution; Controllers/HomeController.cs Controllers/Administration/AdministrationController.cs Controllers/Administration/UsersController.cs Views/Home/Index.aspx

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.