Create an Address Book with CakePHP 3+ & Netbeans

Using the CakePHP 3+ framework and Netbeans 8.1 to create a simple Address Book  web application.  I’m building this project locally with a XAMPP installation on a Win10 machine.

Basic requirements

You’ll need at least the following

  • Some PHP coding experience
  • Access to an Apache server with PHP & MySQL
  • Netbeans 8+
  • Happiness

Before we start the CakePHP project

You’ll need to install Netbeans IDE with PHP support .

Install the Netbeans plugin for CakePHP.
https://github.com/junichi11/cakephp3-netbeans

If you are using XAMPP, you may have to verify your  PHP.ini settings and have the following
extension=php_intl.dll
not
;extension=php_intl.dll
(i.e. uncomment the line)

I’m also using Composer, a dependancy manager, which is easy to install and very very helpful. So just go here  https://getcomposer.org/ and follow the instructions.

You must also be able to execute CLI  (Command Line Interface) PHP commands. This can be tricky to set up and is very dependant on your own environment. There is plenty of information on the web about this, search for  CLI PHP and or go to the PHP site.

Creating your Address Book

We should now be about ready to create the project, we’ll try and create a simple web based address book. Let’s see if we have the same screen shots in the following steps.

Step 1: Click File -> New Project

Create the project selecting the CakePHP 3 framework
Create the project selecting the CakePHP 3 framework
Address book project
Address book project

Step 2 : Let’s call the project addressbook and the location for all the files should be accesible through your server, so set the paths correctly.

Step 3: Click on finish and then Composer kicks in and starts to do it’s magic.

Composer downloads the latest files
Composer downloads the latest files

Once Composer has finished your address book should have this structure in the Project tab.

The address book project
The address book project

Step 4: Check what the server dishes up in your browser, you should see something very similar to the screen  below

CakePHP default home page
CakePHP default home page

If you have some other strange errors, such as vendor/autoload.php not found, try using Composer to update your project. !To do so, follow the next screen .

Keeping it all upto date
Keeping it all upto date

 

Let’s start editing the files

Step 6 : Create a database and name it addressbook , then open /config/app.php and set the necessary values  for connecting to your database.

7

This should remove the “CakePHP is NOT able to connect to the database” error message.

Make sure you have ‘debug’ => true, refresh the home page and you should have no errors.

Now before continuing, click on the  yellow icon located bottom right by default (it used to be top right in Cake2).

debug
Click the icon to open the Debug

Once you’ve clicked, the debug plugin will open as shown below.

debug- interface
Debug interface

 

Next…

Data and databases

More coming soon.