Posts

Showing posts with the label CakePHP

CakePHP - Environment Setup - Ubuntu

Image
Hello everyone, In this tutorial, we will set up a CakePHP development environment in Ubuntu. We’ll install Apache2 HTTP, MariaDB, PHP 7.2, Composer and CakePHP in order to provide you with the tools necessary for developing web applications with  CakePHP . Step 1 — Install Apache2 HTTP Apache is available within Ubuntu’s default software repositories, making it possible to install it using conventional package management tools.  Let’s begin by updating the local package index to reflect the latest upstream changes: $ sudo apt-get update && sudo apt-get -y upgrade Then, install the apache2 package: $ sudo apt install apache2 After installing Apache2, the commands below can be used to stop, start and enable Apache2 service to always start up with the server boots. $ sudo systemctl stop apache2.service $ sudo systemctl start apache2.service $ sudo systemctl enable apache2.service Confirm whether apache is successfully installed on your machine. http://loca

CakePHP + MySQL CRUD Example

Image
Hello everyone, today we will learn how to develop a basic User Management Application using CakePHP and MySQL. -Add User: - Retrieve all Users: -Update User: Step 1 —  CakePHP - Environment Setup  - click here Step 2 — Create table_users CREATE TABLE IF NOT EXISTS tbl_users ( id int ( 10 ) unsigned NOT NULL AUTO_INCREMENT, name varchar ( 120 ) COLLATE utf8_unicode_ci NOT NULL , email varchar ( 120 ) COLLATE utf8_unicode_ci NOT NULL , phone_no varchar ( 30 ) COLLATE utf8_unicode_ci NOT NULL , PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE =utf8_unicode_ci; Step 3 —  Add CRUD routes[routes.php ] Go to var >> www >> cakephp >> app >> config >> routes.php <?php use Cake\Routing\Route\DashedRoute; use Cake\Routing\RouteBuilder; return static function (RouteBuilder $routes) { $routes->setRouteClass(DashedRoute:: class ); $routes->scope( '/' , function (RouteBuilder $builder) {