Free Online Courses for Software Developers - MrBool
× Please, log in to give us a feedback. Click here to login
×

You must be logged to download. Click here to login

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

Getting started with CodeIgniter

In this article we are going to meet the CodeIgniter PHP framework, that allows us to easily develop new web applications based on the MVC architectural pattern.

Motivation

When we are starting a new project, we usually look for the best tools and practices which help us to get the best performance and results. When it comes to web development, we normally chose to use a framework that better meet our needs, depending on the project’s scope. In these cases, it is important to consider aspects like cross-platform support (for development) and native functions to common tasks like database access, cryptography, session control, etc.

For PHP developers, there are a lot of options that can be used for many types of applications, from the most simple to that complex ones, like portals and e-commerces. In this article we are going to see how to start using one of the most popular frameworks today: CodeIgniter.

About CodeIgniter

CodeIgniter is an open source PHP framework that implements the MVC (Model-View-Controller) pattern and can be used to develop many kinds of web applications.

Its simple and clear structure allows us to create a new project with almost zero configuration, saving development time and focusing on the most important parts of our application.

The framework also counts on a thorough and clear documentation, as well as a great community suport on its official forum.

Creating our first project

To create a new project with CodeIgniter, we just need to download the latest stable version in its official site and extract the ZIP file in our server. For instance, if we are using XAMPP, we can extract the compressed file to C:\xampp\htdocs.

It will give us a folder containing three important folders and one file:

  • application: this folder contains the project structure in which we will work. Here we can find, for example, the models, views and controllers directories;
  • system: in this folder we can find the core of the framework. All the native classes we will need to develop our project are stored in this directory, that should not be moved or modified (except if you are really interested in changing the framework’s core);
  • user_guide: here we can see the framework’s documentation. This folder is very useful when we need to consult the manuals, but can’t access the online version. Nevertheless, we don’t need to send this folder to the production environment;
  • index.php: this is the central file of our application. Here we can find some important settings like the system and application folder’s path, as well as the application environment (development, production or test).

Into the application/controller folder we can find a default controller (Welcome.php) and a basic view (welcome_message.php) in the views directory. The Welcome controller, by default, will call the “welcome message” when we access it in browser.

Executing the project

If we are using Apache (installed by XAMPP or WAMPP, for instance), we just need to access its base URL, followed by the name of our project’s folder. For example, if we extracted the CodeIgniter downloaded file and renamed the folder to “MyFirstProject”, we can access the address http://localhost:8080/MyFirstProject and we will see a default page, as shown in Figure 1.


Figure 1. Project’s initial page

If you prefer, you can use the PHP embed server to start the application. To do this, open the command prompt, navigate to the project folder and run the following command, so the application will be available at http://localhost:8080:

php -s localhost:8080

Now you can open the application folder in your favorite editor, add a new controller and start playing with CodeIgniter.



Microsoft MVP, Bachelor in Science And Technology, Editor and Consultant at DevMedia with more than 7 years of experience in software development.

What did you think of this post?
Services
[Close]
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits
[Close]
You must be logged to download.

Click here to login