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.
You’ll need at least the following
- Some PHP coding experience
- Access to an Apache server with PHP & MySQL
- Netbeans 8+
Before we start the CakePHP project
You’ll need to install Netbeans IDE with PHP support .
Install the Netbeans plugin for CakePHP.
If you are using XAMPP, you may have to verify your PHP.ini settings and have the following
(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
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.
Once Composer has finished your address book should have this structure in the Project tab.
Step 4: Check what the server dishes up in your browser, you should see something very similar to the screen below
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 .
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.
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).
Once you’ve clicked, the debug plugin will open as shown below.
Data and databases
More coming soon.