{"id":327,"date":"2014-11-27T13:19:02","date_gmt":"2014-11-27T13:19:02","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=327"},"modified":"2015-10-30T08:29:29","modified_gmt":"2015-10-30T08:29:29","slug":"cakephp-tutorial-beginners","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/","title":{"rendered":"CakePHP Tutorial for Beginners"},"content":{"rendered":"<p>CakePHP is an open source web application framework. It follows the Model-View-Controller (MVC) approach and written in PHP. CakePHP makes building web applications simpler, faster and require less code.<\/p>\n<p>This CakePHP tutorial will drive you to the right direction for getting started with CakePHP framework and provide basic guide of CakePHP application development. Our step by step cakePHP tutorial helps beginners for install and configures the CakePHP application. You can learn CakePHP from scratch with our easy tutorial. Also we will develop a sample CakePHP project and it will help you for better understanding the whole process.<\/p>\n<p>Application flow of the CakePHP are given below:<\/p>\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-application-flow.png\" alt=\"cakephp-application-flow\" width=\"604\" height=\"397\" class=\"alignnone size-full wp-image-329\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-application-flow.png 604w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-application-flow-300x197.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-application-flow-170x111.png 170w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/div>\n<h2>Download CakePHP<\/h2>\n<p>At first you need to download the stable release of CakePHP from Github &#8211; <a href=\"https:\/\/github.com\/cakephp\/cakephp\/tags\" target=\"_blank\">CakePHP Releases<\/a><\/p>\n<h2>Basic Configuration<\/h2>\n<ul>\n<li><b>Step1:<\/b>&nbsp;Extract zip file and change folder name with your desire project name. For example <code>cakephp\/<\/code>.<\/li>\n<li><b>Step2:<\/b>&nbsp;Move the <code>cakephp\/<\/code> folder to the localhost server. Your directory setup looks like the following.\n<ul class=\"folder_structure\">\n<li><b>\/cakephp<\/b>\n<ul>\n<li>\/app<\/li>\n<li>\/lib<\/li>\n<li>\/plugins<\/li>\n<li>\/vendors<\/li>\n<li><code>.htaccess<\/code><\/li>\n<li><code>index.php<\/code><\/li>\n<li><code>README<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><b>Step3:<\/b>&nbsp;Create database at the phpMyAdmin. For example <code>cakephp_db<\/code>.<\/li>\n<li><b>Step4:<\/b>&nbsp;Open the <code>app\/Config\/core.php<\/code> file and make the following changes.\n<ul>\n<li><span class=\"glyphicon glyphicon-forward\"><\/span>&nbsp;Change the value of <code>Security.salt<\/code> at Line no.225.\n<ul>\n<li>Before changes:\n<pre><span style=\"color: #000000\">Configure<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">write<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'Security.salt'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi'<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<\/li>\n<li>After changes:\n<pre><span style=\"color: #000000\">Configure<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">write<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'Security.salt'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'codexworld'<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><span class=\"glyphicon glyphicon-forward\"><\/span>&nbsp;Change the value of <code>Security.cipherSeed<\/code> at Line no.230.\n<ul>\n<li>Before changes:\n<pre><span style=\"color: #000000\">Configure<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">write<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'Security.cipherSeed'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'76859309657453542496749683645'<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<\/li>\n<li>After changes:\n<pre><span style=\"color: #000000\">Configure<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">write<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'Security.cipherSeed'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'123456'<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><b>Step5:<\/b>&nbsp;Rename <code>database.php.default<\/code> file to <code>database.php<\/code> at the <code>app\/Config\/<\/code> directory.<\/li>\n<li><b>Step6:<\/b>&nbsp;Open the \u201capp\/Config\/database.php\u201d file and make the following changes.\n<ul>\n<li><span class=\"glyphicon glyphicon-forward\"><\/span>&nbsp;Go to the line no.67 and replace the values of host, login, password, database_name with your database host, database username, database password and database name.\n<ul>\n<li>Before changes:\n<pre><span style=\"color: #000000\"><span style=\"color: #007700\">public&nbsp;<\/span><span style=\"color: #0000BB\">$default&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'datasource'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Database\/Mysql'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'persistent'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">false<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'host'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'localhost'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'login'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'user'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'password'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'password'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'database'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'database_name'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'prefix'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">''<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/'encoding'&nbsp;=&gt;&nbsp;'utf8',\r\n<br \/><\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<\/li>\n<li>After changes:\n<pre><span style=\"color: #000000\"><span style=\"color: #007700\">public&nbsp;<\/span><span style=\"color: #0000BB\">$default&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'datasource'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Database\/Mysql'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'persistent'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">false<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'host'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'localhost'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'login'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'root'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'password'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">''<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'database'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'cakephp_db'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'prefix'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">''<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/'encoding'&nbsp;=&gt;&nbsp;'utf8',<br \/><\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><b>Step7:<\/b>&nbsp;Run the project URL(<code>http:\/\/localhost\/cakephp\/<\/code>) at the browser.\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/screencapture-cakephp-configuration-1024x1017.png\" alt=\"screencapture-cakephp-configuration\" width=\"960\" height=\"953\" class=\"alignnone size-large wp-image-330\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/screencapture-cakephp-configuration-1024x1017.png 1024w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/screencapture-cakephp-configuration-150x150.png 150w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/screencapture-cakephp-configuration-300x298.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/screencapture-cakephp-configuration-170x168.png 170w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/screencapture-cakephp-configuration.png 1600w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/div>\n<\/li>\n<\/ul>\n<h2>CakePHP Naming Conventions<\/h2>\n<ul>\n<li><b>Controller Conventions \u2013<\/b> Controller class names are plural, CamelCased and end in Controller.(<code>PostsController<\/code>, <code>LatestPostsController<\/code>)<\/li>\n<li><b>Model Conventions \u2013<\/b> Model class names are singular and CamelCased.(<code>Post<\/code>, <code>LatestPost<\/code>)<\/li>\n<li><b>Database Conventions \u2013<\/b> Table names corresponding to CakePHP models are plural and underscored. (<code>posts<\/code>, <code>latest_posts<\/code>)<\/li>\n<li><b>View Conventions \u2013<\/b> View template files are named after the controller functions they displayed, in an underscored form. The <code>postDetails()<\/code> function of PostController class will look for a view template in <code>app\/View\/Post\/post_details.ctp<\/code>. The basic pattern is <code>app\/View\/Controller\/underscored_function_name.ctp<\/code><\/li>\n<\/ul>\n<h2>Sample Project<\/h2>\n<p>In this sample project we will create a products table at the cakephp_db database. And we will insert some data manually at this table. We will fetch and display products in our sample CakePHP project.<\/p>\n<p><b>Table Creation &#038; Data Insert:<\/b> Following SQL is used for products table creation.<\/p>\n<pre><span style=\"color:#794938\">CREATE<\/span> <span style=\"color:#794938\">TABLE<\/span> `<span style=\"color:#bf4f24\">products<\/span>` (\r\n <span style=\"color:#0b6125\">`id`<\/span> <span style=\"color:#a71d5d;font-style:italic\">int<\/span>(<span style=\"color:#811f24;font-weight:700\">11<\/span>) <span style=\"color:#794938\">NOT NULL<\/span> AUTO_INCREMENT,\r\n <span style=\"color:#0b6125\">`title`<\/span> <span style=\"color:#a71d5d;font-style:italic\">varchar<\/span>(<span style=\"color:#811f24;font-weight:700\">255<\/span>) COLLATE utf8_unicode_ci <span style=\"color:#794938\">NOT NULL<\/span>,\r\n <span style=\"color:#0b6125\">`description`<\/span> <span style=\"color:#a71d5d;font-style:italic\">text<\/span> COLLATE utf8_unicode_ci <span style=\"color:#794938\">NOT NULL<\/span>,\r\n <span style=\"color:#0b6125\">`price`<\/span> float(<span style=\"color:#811f24;font-weight:700\">10<\/span>,<span style=\"color:#811f24;font-weight:700\">2<\/span>) <span style=\"color:#794938\">NOT NULL<\/span>,\r\n <span style=\"color:#0b6125\">`created`<\/span> datetime <span style=\"color:#794938\">NOT NULL<\/span>,\r\n <span style=\"color:#0b6125\">`modified`<\/span> datetime <span style=\"color:#794938\">NOT NULL<\/span>,\r\n <span style=\"color:#0b6125\">`status`<\/span> <span style=\"color:#a71d5d;font-style:italic\">tinyint<\/span>(<span style=\"color:#811f24;font-weight:700\">1<\/span>) <span style=\"color:#794938\">NOT NULL<\/span> DEFAULT <span style=\"color:#0b6125\">'1'<\/span>,\r\n <span style=\"color:#a71d5d;font-style:italic\">PRIMARY KEY<\/span> (<span style=\"color:#0b6125\">`id`<\/span>)\r\n) ENGINE<span style=\"color:#794938\">=<\/span>InnoDB AUTO_INCREMENT<span style=\"color:#794938\">=<\/span><span style=\"color:#811f24;font-weight:700\">5<\/span> DEFAULT CHARSET<span style=\"color:#794938\">=<\/span>utf8 COLLATE<span style=\"color:#794938\">=<\/span>utf8_unicode_ci<\/pre>\n<p>Once table creation is completed, insert some demo product data into this table.<\/p>\n<p><b>Controller:<\/b> Create a products controller with ProductsController class into the <code>app\/Controller\/<\/code> directory. Controller file and class name should be ProductsController.  <\/p>\n<pre><span style=\"color: #000000\"><span style=\"color: #0000BB\">&lt;?php<br \/><\/span><span style=\"color: #007700\">class&nbsp;<\/span><span style=\"color: #0000BB\">ProductsController&nbsp;<\/span><span style=\"color: #007700\">extends&nbsp;<\/span><span style=\"color: #0000BB\">AppController&nbsp;<\/span><span style=\"color: #007700\">{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">index<\/span><span style=\"color: #007700\">()&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/fetch&nbsp;products&nbsp;resultset&nbsp;from&nbsp;databse<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$products&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Product<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">find<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'all'<\/span><span style=\"color: #007700\">,array(<\/span><span style=\"color: #DD0000\">'fields'<\/span><span style=\"color: #007700\">=&gt;array(<\/span><span style=\"color: #DD0000\">'Product.id'<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #DD0000\">'Product.title'<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #DD0000\">'Product.description'<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #DD0000\">'Product.price'<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #DD0000\">'Product.created'<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #DD0000\">'Product.status'<\/span><span style=\"color: #007700\">),<\/span><span style=\"color: #DD0000\">'conditions'<\/span><span style=\"color: #007700\">=&gt;array(<\/span><span style=\"color: #DD0000\">'Product.status'<\/span><span style=\"color: #007700\">=&gt;<\/span><span style=\"color: #0000BB\">1<\/span><span style=\"color: #007700\">)));\r\n<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/set&nbsp;products&nbsp;data&nbsp;and&nbsp;pass&nbsp;to&nbsp;the&nbsp;view&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">set<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'products'<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$products<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>}<\/span><\/span><\/pre>\n<p><b>View:<\/b> Create view for display products in <code>app\/View\/<\/code> directory. The controller class name is ProductsController and method is index. For creating the index view, we need to <code>Products\/<\/code> directory and a <code>index.ctp<\/code> file. So, the complete path of the view file (<code>index.ctp<\/code>) would be <code>app\/View\/Products\/index.ctp<\/code>.<\/p>\n<pre>&lt;<span style=\"color:#bf4f24\">ul<\/span>>\r\n<span style=\"background:rgba(111,139,186,0.15)\">&lt;?php<span style=\"color:#794938\"> foreach<\/span>(<span style=\"color:#234a97\">$products<\/span> <span style=\"color:#794938\">as<\/span> <span style=\"color:#234a97\">$row<\/span>): ?><\/span>\r\n    &lt;<span style=\"color:#bf4f24\">li<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">h1<\/span>><span style=\"background:rgba(111,139,186,0.15)\">&lt;?php <span style=\"color:#693a17\">echo<\/span> <span style=\"color:#234a97\">$row<\/span>[<span style=\"color:#0b6125\">'Product'<\/span>][<span style=\"color:#0b6125\">'title'<\/span>]; ?><\/span>&lt;\/<span style=\"color:#bf4f24\">h1<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">h6<\/span>>Price: <span style=\"background:rgba(111,139,186,0.15)\">&lt;?php <span style=\"color:#693a17\">echo<\/span> <span style=\"color:#234a97\">$row<\/span>[<span style=\"color:#0b6125\">'Product'<\/span>][<span style=\"color:#0b6125\">'price'<\/span>]; ?><\/span>&lt;\/<span style=\"color:#bf4f24\">h6<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">p<\/span>><span style=\"background:rgba(111,139,186,0.15)\">&lt;?php <span style=\"color:#693a17\">echo<\/span> <span style=\"color:#234a97\">$row<\/span>[<span style=\"color:#0b6125\">'Product'<\/span>][<span style=\"color:#0b6125\">'description'<\/span>]; ?><\/span>&lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n    &lt;\/<span style=\"color:#bf4f24\">li<\/span>>\r\n<span style=\"background:rgba(111,139,186,0.15)\">&lt;?php<span style=\"color:#794938\"> endforeach<\/span>; ?><\/span>\r\n&lt;\/<span style=\"color:#bf4f24\">ul<\/span>>\r\n<\/pre>\n<p><b>Model:<\/b>  Model creation is not required until you need validation or associations. <\/p>\n<p><b>Routes:<\/b> Open the <code>app\/Config\/routes.php<\/code> file and set the default controller and action. Go to the line no.27 and change controller name from &quot;pages&quot; to &quot;products&quot; and action name from &quot;display&quot; to &quot;index&quot;. If you want to load the different view for this action, you need to pass the view file name after the action element.<\/p>\n<pre><span style=\"color: #000000\">Router<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">connect<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'\/'<\/span><span style=\"color: #007700\">,&nbsp;array(<\/span><span style=\"color: #DD0000\">'controller'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'products'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'action'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'index'<\/span><span style=\"color: #007700\">));<\/span><\/span><\/pre>\n<p><b>Testing:<\/b> Run the base URL at the browser, products list would displayed.<\/p>\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/screencapture-cakephp-display-data-1024x305.png\" alt=\"screencapture-cakephp-display-data\" width=\"960\" height=\"285\" class=\"alignnone size-large wp-image-331\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/screencapture-cakephp-display-data-1024x305.png 1024w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/screencapture-cakephp-display-data-300x89.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/screencapture-cakephp-display-data-170x50.png 170w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/div>\n<div><\/div>\n<p><span class=\"glyphicon glyphicon-hand-right\"><\/span>&nbsp;Our next post will explain about layout, database and advanced label of CakePHP. Please follow CodexWorld for notify about the next post. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>CakePHP is an open source web application framework. It follows the Model-View-Controller (MVC) approach and written in PHP. CakePHP makes building web applications simpler, faster and require less code. This CakePHP tutorial will drive you <\/p>\n","protected":false},"author":1,"featured_media":539,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[12],"tags":[],"class_list":["post-327","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cakephp","cat-12-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>CakePHP Tutorial for Beginners - CodexWorld<\/title>\n<meta name=\"description\" content=\"Step by step CakePHP tutorial from scratch \u2013 Learn cakephp framework installation, basic configuration, controller, view, routes, database and setup.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CakePHP Tutorial for Beginners - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Step by step CakePHP tutorial from scratch \u2013 Learn cakephp framework installation, basic configuration, controller, view, routes, database and setup.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2014-11-27T13:19:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-10-30T08:29:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-tutorial-for-beginners-by-codexworld1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"479\" \/>\n\t<meta property=\"og:image:height\" content=\"390\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"CakePHP Tutorial for Beginners\",\"datePublished\":\"2014-11-27T13:19:02+00:00\",\"dateModified\":\"2015-10-30T08:29:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/\"},\"wordCount\":571,\"commentCount\":43,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/11\\\/cakephp-tutorial-for-beginners-by-codexworld1.png\",\"articleSection\":[\"CakePHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/\",\"name\":\"CakePHP Tutorial for Beginners - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/11\\\/cakephp-tutorial-for-beginners-by-codexworld1.png\",\"datePublished\":\"2014-11-27T13:19:02+00:00\",\"dateModified\":\"2015-10-30T08:29:29+00:00\",\"description\":\"Step by step CakePHP tutorial from scratch \u2013 Learn cakephp framework installation, basic configuration, controller, view, routes, database and setup.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/11\\\/cakephp-tutorial-for-beginners-by-codexworld1.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/11\\\/cakephp-tutorial-for-beginners-by-codexworld1.png\",\"width\":479,\"height\":390,\"caption\":\"cakephp-tutorial-for-beginners-by-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/cakephp-tutorial-beginners\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CakePHP Tutorial for Beginners\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CakePHP Tutorial for Beginners - CodexWorld","description":"Step by step CakePHP tutorial from scratch \u2013 Learn cakephp framework installation, basic configuration, controller, view, routes, database and setup.","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:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/","og_locale":"en_US","og_type":"article","og_title":"CakePHP Tutorial for Beginners - CodexWorld","og_description":"Step by step CakePHP tutorial from scratch \u2013 Learn cakephp framework installation, basic configuration, controller, view, routes, database and setup.","og_url":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2014-11-27T13:19:02+00:00","article_modified_time":"2015-10-30T08:29:29+00:00","og_image":[{"width":479,"height":390,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-tutorial-for-beginners-by-codexworld1.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"CakePHP Tutorial for Beginners","datePublished":"2014-11-27T13:19:02+00:00","dateModified":"2015-10-30T08:29:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/"},"wordCount":571,"commentCount":43,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-tutorial-for-beginners-by-codexworld1.png","articleSection":["CakePHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/","url":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/","name":"CakePHP Tutorial for Beginners - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-tutorial-for-beginners-by-codexworld1.png","datePublished":"2014-11-27T13:19:02+00:00","dateModified":"2015-10-30T08:29:29+00:00","description":"Step by step CakePHP tutorial from scratch \u2013 Learn cakephp framework installation, basic configuration, controller, view, routes, database and setup.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-tutorial-for-beginners-by-codexworld1.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-tutorial-for-beginners-by-codexworld1.png","width":479,"height":390,"caption":"cakephp-tutorial-for-beginners-by-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/cakephp-tutorial-beginners\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"CakePHP Tutorial for Beginners"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/11\/cakephp-tutorial-for-beginners-by-codexworld1.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-5h","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=327"}],"version-history":[{"count":14,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/327\/revisions"}],"predecessor-version":[{"id":973,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/327\/revisions\/973"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/539"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}