{"id":2500,"date":"2024-10-07T14:40:52","date_gmt":"2024-10-07T13:40:52","guid":{"rendered":"https:\/\/codeflarelimited.com\/blog\/?p=2500"},"modified":"2024-10-08T10:49:05","modified_gmt":"2024-10-08T09:49:05","slug":"custom-mvc-framework-with","status":"publish","type":"post","link":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/","title":{"rendered":"Creating a Custom MVC Framework with PHP"},"content":{"rendered":"\n<p>In web development, frameworks are essential for building scalable and maintainable applications. While there are many popular frameworks like Laravel and Symfony, building your own custom MVC (Model-View-Controller) framework can help deepen your understanding of PHP and how web frameworks operate. In this article, we&#8217;ll walk through the basic concepts and steps involved in creating a simple MVC framework from scratch using PHP.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>What is MVC?<\/strong><\/h4>\n\n\n\n<p>MVC (Model-View-Controller) is a design pattern that separates an application into three interconnected components:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Model<\/strong>: The logic and data of the application. It handles database interactions, data validation, and business logic.<\/li>\n\n\n\n<li><strong>View<\/strong>: The presentation layer that displays data to users, typically in the form of HTML.<\/li>\n\n\n\n<li><strong>Controller<\/strong>: The intermediary between the Model and View. It processes user input and calls the necessary logic from the Model and updates the View accordingly.<\/li>\n<\/ul>\n\n\n\n<p>This separation of concerns makes it easier to manage code, improve scalability, and allow different team members to work on various aspects of an application.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step-by-Step Guide to Building a Custom MVC Framework<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 1: Setting Up the File Structure<\/strong><\/h4>\n\n\n\n<p>The first step is to create a well-organized file structure for your framework. Here&#8217;s a simple structure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">\/myMVCframework\n    \/app\n        \/controllers\n        \/models\n        \/views\n    \/core\n        Controller.php\n        Model.php\n        View.php\n    \/public\n        index.php\n    .htaccess\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>app\/controllers<\/strong>: This folder will contain your application&#8217;s controllers.<\/li>\n\n\n\n<li><strong>app\/models<\/strong>: This folder will store your application&#8217;s models, which represent the data and business logic.<\/li>\n\n\n\n<li><strong>app\/views<\/strong>: This folder will contain the HTML templates and other UI elements that users see.<\/li>\n\n\n\n<li><strong>core<\/strong>: This folder will hold the core classes of your framework, such as the base controller, model, and view classes.<\/li>\n\n\n\n<li><strong>public\/index.php<\/strong>: This is the entry point of the application. All requests will go through this file.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 2: Setting Up Routing in <code>.htaccess<\/code><\/strong><\/h4>\n\n\n\n<p>The <code>.htaccess<\/code> file will ensure that all requests are directed to <code>index.php<\/code>, which will handle the routing of your application.<\/p>\n\n\n\n<p><strong>.htaccess:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">RewriteEngine On\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule ^(.*)$ index.php [QSA,L]\n<\/code><\/pre>\n\n\n\n<p>This configuration directs all incoming requests to the <code>index.php<\/code> file, regardless of the URL.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 3: Creating the Core Files (Controller, Model, and View)<\/strong><\/h4>\n\n\n\n<p>Let&#8217;s create the basic functionality for the Controller, Model, and View.<\/p>\n\n\n\n<p><strong>core\/Controller.php:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\nclass Controller {\n    public function view($view, $data = []) {\n        require_once '..\/app\/views\/' . $view . '.php';\n    }\n\n    public function model($model) {\n        require_once '..\/app\/models\/' . $model . '.php';\n        return new $model();\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>This base <code>Controller<\/code> class allows us to load views and models. It will be extended by all specific controllers in the <code>app\/controllers<\/code> directory.<\/p>\n\n\n\n<p><strong>core\/Model.php:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\nclass Model {\n    \/\/ Here you can define the database connection and methods to interact with the database\n}\n<\/code><\/pre>\n\n\n\n<p>The <code>Model.php<\/code> will be used as the parent class for all models. For now, we\u2019ll keep it simple, but later it can be extended to include database interactions.<\/p>\n\n\n\n<p><strong>core\/View.php:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\nclass View {\n    \/\/ This class will be responsible for rendering the views\n}\n<\/code><\/pre>\n\n\n\n<p>The <code>View.php<\/code> class will handle the presentation layer of the application, such as rendering HTML and passing data from the controller to the view.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 4: Handling Routing and Requests in <code>index.php<\/code><\/strong><\/h4>\n\n\n\n<p>In the <code>public\/index.php<\/code> file, we will handle the routing and direct requests to the correct controller and action.<\/p>\n\n\n\n<p><strong>public\/index.php<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\n\/\/ Include the core files\nrequire_once '..\/core\/Controller.php';\n\n\/\/ Get the URL and split it into parts\n$url = isset($_GET['url']) ? $_GET['url'] : null;\n$url = rtrim($url, '\/');\n$url = filter_var($url, FILTER_SANITIZE_URL);\n$url = explode('\/', $url);\n\n\/\/ Example: \/home\/index\n$controller = !empty($url[0]) ? $url[0] : 'home'; \/\/ Default controller is 'home'\n$method = isset($url[1]) ? $url[1] : 'index';     \/\/ Default method is 'index'\n$params = array_slice($url, 2);                   \/\/ Any additional parameters\n\n\/\/ Check if the controller exists\nif (file_exists('..\/app\/controllers\/' . ucfirst($controller) . '.php')) {\n    require_once '..\/app\/controllers\/' . ucfirst($controller) . '.php';\n    $controller = new $controller();\n    \n    \/\/ Check if the method exists\n    if (method_exists($controller, $method)) {\n        call_user_func_array([$controller, $method], $params);\n    } else {\n        echo 'Method not found!';\n    }\n} else {\n    echo 'Controller not found!';\n}\n<\/code><\/pre>\n\n\n\n<p>This script fetches the controller, method, and parameters from the URL, then loads and calls the appropriate controller and method.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 5: Creating a Simple Controller and View<\/strong><\/h4>\n\n\n\n<p>Now that our core structure is in place, let\u2019s create a simple controller and view to see our framework in action.<\/p>\n\n\n\n<p><strong>app\/controllers\/Home.php<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\nclass Home extends Controller {\n    public function index() {\n        $data = ['title' =&gt; 'Welcome to My Custom MVC Framework'];\n        $this-&gt;view('home\/index', $data);\n    }\n}\n<\/code><\/pre>\n\n\n\n<p><strong>app\/views\/home\/index.php<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;title&gt;&lt;?php echo $data['title']; ?&gt;&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;h1&gt;&lt;?php echo $data['title']; ?&gt;&lt;\/h1&gt;\n    &lt;p&gt;This is a simple MVC framework built with PHP!&lt;\/p&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n\n\n\n<p>When a user visits <code>\/home\/index<\/code> (or just <code>\/<\/code>, since <code>home\/index<\/code> is the default), the <code>Home<\/code> controller\u2019s <code>index<\/code> method will be called, which loads the <code>home\/index.php<\/code> view with the <code>$data<\/code> array passed from the controller.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 6: Adding a Model<\/strong><\/h4>\n\n\n\n<p>We\u2019ll now add a simple model to demonstrate how the MVC pattern works together.<\/p>\n\n\n\n<p><strong>app\/models\/User.php<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\nclass User {\n    public function getUsers() {\n        return ['John', 'Jane', 'Doe'];\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Update the controller to use this model:<\/p>\n\n\n\n<p><strong>app\/controllers\/Home.php<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\nclass Home extends Controller {\n    public function index() {\n        $userModel = $this-&gt;model('User');\n        $users = $userModel-&gt;getUsers();\n        \n        $data = [\n            'title' =&gt; 'Welcome to My Custom MVC Framework',\n            'users' =&gt; $users\n        ];\n        $this-&gt;view('home\/index', $data);\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Update the view to display the users:<\/p>\n\n\n\n<p><strong>app\/views\/home\/index.php<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;title&gt;&lt;?php echo $data['title']; ?&gt;&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;h1&gt;&lt;?php echo $data['title']; ?&gt;&lt;\/h1&gt;\n    &lt;p&gt;This is a simple MVC framework built with PHP!&lt;\/p&gt;\n    \n    &lt;h2&gt;Users:&lt;\/h2&gt;\n    &lt;ul&gt;\n        &lt;?php foreach($data['users'] as $user): ?&gt;\n            &lt;li&gt;&lt;?php echo $user; ?&gt;&lt;\/li&gt;\n        &lt;?php endforeach; ?&gt;\n    &lt;\/ul&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n\n\n\n<p>Now when you visit the <code>home\/index<\/code> route, the users will be displayed.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h3>\n\n\n\n<p>Building your own custom MVC framework in PHP may seem challenging at first, but it\u2019s a fantastic way to better understand the core concepts behind web development and frameworks in general. By following this guide, you now have a basic framework to build upon, and you can extend it to include more features like database connections, authentication, and routing.<\/p>\n\n\n\n<p>Once you&#8217;ve mastered the fundamentals, you&#8217;ll have a deeper appreciation for frameworks like Laravel and Symfony, and you\u2019ll be able to customize your projects to suit specific requirements.<\/p>\n\n\n\n<p><a href=\"https:\/\/codeflarelimited.com\/blog\/php-sessions-and-cookies\/\">Understanding the difference between PHP Sessions and Cookies<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In web development, frameworks are essential for building scalable and maintainable applications. While there are many popular frameworks<\/p>\n","protected":false},"author":3,"featured_media":2506,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[87],"tags":[99],"class_list":["post-2500","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-software-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Custom MVC Framework with PHP<\/title>\n<meta name=\"description\" content=\"Learn how to build a custom MVC framework with PHP from scratch, perfect for beginners looking to understand the core concepts of Model-View-\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom MVC Framework with PHP\" \/>\n<meta property=\"og:description\" content=\"Learn how to build a custom MVC framework with PHP from scratch, perfect for beginners looking to understand the core concepts of Model-View-\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-07T13:40:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-08T09:49:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/10\/IMG-20241007-WA0044.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"607\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Kene Samuel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/\"},\"author\":{\"name\":\"Kene Samuel\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/person\\\/c501609bab46c16807eb32106074f206\"},\"headline\":\"Creating a Custom MVC Framework with PHP\",\"datePublished\":\"2024-10-07T13:40:52+00:00\",\"dateModified\":\"2024-10-08T09:49:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/\"},\"wordCount\":684,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/IMG-20241007-WA0044.jpg\",\"keywords\":[\"software development\"],\"articleSection\":[\"php\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/\",\"name\":\"Custom MVC Framework with PHP\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/IMG-20241007-WA0044.jpg\",\"datePublished\":\"2024-10-07T13:40:52+00:00\",\"dateModified\":\"2024-10-08T09:49:05+00:00\",\"description\":\"Learn how to build a custom MVC framework with PHP from scratch, perfect for beginners looking to understand the core concepts of Model-View-\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/#primaryimage\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/IMG-20241007-WA0044.jpg\",\"contentUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/IMG-20241007-WA0044.jpg\",\"width\":1080,\"height\":607},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/custom-mvc-framework-with\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"php\",\"item\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/php\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Creating a Custom MVC Framework with PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\",\"name\":\"\",\"description\":\"Sustainable solutions\",\"publisher\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\",\"name\":\"Codeflare Limited\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/codeflare.png\",\"contentUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/codeflare.png\",\"width\":1040,\"height\":263,\"caption\":\"Codeflare Limited\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/person\\\/c501609bab46c16807eb32106074f206\",\"name\":\"Kene Samuel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g\",\"caption\":\"Kene Samuel\"},\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/author\\\/kene\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Custom MVC Framework with PHP","description":"Learn how to build a custom MVC framework with PHP from scratch, perfect for beginners looking to understand the core concepts of Model-View-","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/","og_locale":"en_US","og_type":"article","og_title":"Custom MVC Framework with PHP","og_description":"Learn how to build a custom MVC framework with PHP from scratch, perfect for beginners looking to understand the core concepts of Model-View-","og_url":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/","article_published_time":"2024-10-07T13:40:52+00:00","article_modified_time":"2024-10-08T09:49:05+00:00","og_image":[{"width":1080,"height":607,"url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/10\/IMG-20241007-WA0044.jpg","type":"image\/jpeg"}],"author":"Kene Samuel","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/#article","isPartOf":{"@id":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/"},"author":{"name":"Kene Samuel","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/person\/c501609bab46c16807eb32106074f206"},"headline":"Creating a Custom MVC Framework with PHP","datePublished":"2024-10-07T13:40:52+00:00","dateModified":"2024-10-08T09:49:05+00:00","mainEntityOfPage":{"@id":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/"},"wordCount":684,"commentCount":0,"publisher":{"@id":"https:\/\/codeflarelimited.com\/blog\/#organization"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/#primaryimage"},"thumbnailUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/10\/IMG-20241007-WA0044.jpg","keywords":["software development"],"articleSection":["php"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/","url":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/","name":"Custom MVC Framework with PHP","isPartOf":{"@id":"https:\/\/codeflarelimited.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/#primaryimage"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/#primaryimage"},"thumbnailUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/10\/IMG-20241007-WA0044.jpg","datePublished":"2024-10-07T13:40:52+00:00","dateModified":"2024-10-08T09:49:05+00:00","description":"Learn how to build a custom MVC framework with PHP from scratch, perfect for beginners looking to understand the core concepts of Model-View-","breadcrumb":{"@id":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/#primaryimage","url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/10\/IMG-20241007-WA0044.jpg","contentUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/10\/IMG-20241007-WA0044.jpg","width":1080,"height":607},{"@type":"BreadcrumbList","@id":"https:\/\/codeflarelimited.com\/blog\/custom-mvc-framework-with\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codeflarelimited.com\/blog\/"},{"@type":"ListItem","position":2,"name":"php","item":"https:\/\/codeflarelimited.com\/blog\/php\/"},{"@type":"ListItem","position":3,"name":"Creating a Custom MVC Framework with PHP"}]},{"@type":"WebSite","@id":"https:\/\/codeflarelimited.com\/blog\/#website","url":"https:\/\/codeflarelimited.com\/blog\/","name":"","description":"Sustainable solutions","publisher":{"@id":"https:\/\/codeflarelimited.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codeflarelimited.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codeflarelimited.com\/blog\/#organization","name":"Codeflare Limited","url":"https:\/\/codeflarelimited.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2020\/11\/codeflare.png","contentUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2020\/11\/codeflare.png","width":1040,"height":263,"caption":"Codeflare Limited"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/person\/c501609bab46c16807eb32106074f206","name":"Kene Samuel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g","caption":"Kene Samuel"},"url":"https:\/\/codeflarelimited.com\/blog\/author\/kene\/"}]}},"jetpack_featured_media_url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/10\/IMG-20241007-WA0044.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/2500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/comments?post=2500"}],"version-history":[{"count":1,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/2500\/revisions"}],"predecessor-version":[{"id":2501,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/2500\/revisions\/2501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/media\/2506"}],"wp:attachment":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/media?parent=2500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/categories?post=2500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/tags?post=2500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}