SlideShare a Scribd company logo
Have fun with
CodeIgniter Framework
23 April 2016
& Ahmad Arif
About Me
 Pendidikan
 1998-2004 SDN 1 Kertamulya, Karawang
 2004-2007 SMPN 2 Rengasdengklok, Karawang
 2007-2010 SMAN 1 Rengasdengklok, Karawang
 2010-2014 Informatika Universitas Jenderal Achman Yani
 2015-???? Informatika Institut Teknologi Bandung
 Minat
 Programming
 Machine Learning
 Artificial Intelligent
 Game Technology
 Entertainment
 Etc
What is framework?
 Framework = Kerangka kerja
 Menyediakan struktur umum aplikasi sehingga
memudahkan pengembang dalam menyimpan kode
dalam aplikasi
 Menangani tugas umum
– Database
– Business logic
– Form handling
What is CodeIgniter?
 CodeIgniter framework aplikasi web ringan yang ditulis
dalam bahasa pemrograman PHP, dan mengadopsi
pendekatan Model-View-Controller.
Kenapa menggunakan CodeIgniter?
 Feature rich
 Lightweight/small
 Open source
 Well-supported by an active community
 Excellent “by example” documentation
 Easy to configure (nearly zero configuration)
 Supports multiple databases
 Cleaner code
 High Performance
https://github.com/kenjis/php-framework-benchmark
Model-View-Controller
 Model – merepresentasikan data
 View – menyajikan data untuk interaksi dengan user
 Controller – mengontrol model dan data supaya bisa
saling berinteraksi
CodeIgniter Classes
 CI’s built-in classes berisi fungsi dasar yang sering
digunakan oleh aplikasi web
 Beberapa kelas yang sering digunakan:
– Database
– Input
– Loader
– URI
– Validation
Database Class
 Mengolah queri menggunakan the Active Record / ORM
Pattern
 Menyediakan metode “chaining” untuk kemudahan query
 $this->db->where(‘name’,$name);
Input Class
 Menyediakan akses ke input pengguna dan data lainnya:
– Form fields (POST)
– Cookies
– Server variables
 $this->input->post(‘fieldname’);
Loader Class
 Membuat berbagai resource:
– Databases
– Views
– Helpers
– Plugins
 $this->load->view(‘viewname’);
URI Class
 Menyediakan akses ke bagian-bagian tertentu dari String
URI
 Berguna untuk membangung RESTful API
 $this->uri->segment(n);
Other Classes
 Benchmarking
 Calendaring
 Email
 Encryption
 File uploading
 FTP
 HTML Table
 Image Manipulation
 Language
(internationalization)
 Output
 Pagination
 Session
 Trackback
 Unit testing
 XML-RPC
 Zip encoding
Helpers and Plugins
 CodeIgniter dilengkapi dengan berbagai “helper” yaitu
fungsi yang menambahkan kenyamanan terhadap
aplikasi dan memberikan kemudahan reuse code.
 $this->load->helper(‘helper_name’);
 CodeIgniter juga memungkinkan untuk penggunaan
kustom add-on yang disebut “plugins”.
 $this->load->plugin(‘plugin_name’);
Getting Started
 Tools
– Apache HTTP Server
– MySQL Database
– PHP
– Browser
– Code Editor
XAMP, WAMP, MAMP, LAMPP
 Notepad
 Notepad++
 Sublime
 Atom
 PHP Storm
 Etc
Getting Started
 To Do List
– Installation
– Controller
– View
– Model
– RESTful API
Controller
<?php
class BlogController extends CI_Controller {
public function index() {
echo 'Hello World!';
}
public function comments() {
echo 'Look at this!';
}
}
<?php
class BlogController extends CI_Controller {
…
public function page($index) {
echo 'Page: !' . $index;
}
}
View
<html>
<head>
<title>My Blog</title>
</head>
<body>
<h1>Welcome to my Blog!<h1>
</body>
</html>
index.php
$this->load->view(“index”);
Add this code in controller
View
<html>
<head>
<title>My Blog</title>
</head>
<body>
Welcome <strong><?php echo $name ?><strong>
</body>
</html>
index.php
$data = array(
“name” => “Ahmad Arif”
);
$this->load->view(“index”, $data);
Add this code in controller
Model
 Create database and table
 Setting database (config/database.php)
Model
class Blog extends CI_Model {
$tableName = “blog”;
public function insert($title, $content){
$data = array(
“title” => $title,
“content” => $content
);
$this->db->insert($this->tableName, $data);
}
}
Model
class Blog extends CI_Model {
...
public function update($id, $title, $content){
$data = array(
“title” => $title,
“content” => $content
);
$this->db->where(“id”, $id);
$this->db->update($this->tableName, $data);
}
}
Model
class Blog extends CI_Model {
...
public function delete($id){
$this->db->where(“id”, $id);
$this->db->delete($this->tableName);
}
}
Model
class Blog extends CI_Model {
...
public function getAll(){
return $this->db->get($this->tableName)->result();
}
public function getById($id){
$this->db->where(“id”, $id);
return $this->db->get($this->tableName)->row();
}
}
Using Model
class BlogController extends CI_Controller {
...
public function insert(){
$this->load->model(“Blog”);
$title = $this->input->post(“title”);
$content = $this->input->post(“content”);
$this->Blog->insert($title, $content);
}
}
RESTful API
 Tools
– Postman
– Code Editor
 To Do List
– Format JSON/XML
– Routing
– Cache setting
References
 https://codeigniter.com
 https://google.com
 https://github.com/ahmadarif
Tank You

More Related Content

PPTX
Introduction to CodeIgniter
Piti Suwannakom
 
PDF
Introduction To CodeIgniter
Muhammad Hafiz Hasan
 
PPTX
CodeIgniter 101 Tutorial
Konstantinos Magarisiotis
 
PDF
Code igniter - A brief introduction
Commit University
 
PPT
Codeigniter
minhrau111
 
PPT
Benefits of the CodeIgniter Framework
Toby Beresford
 
PPT
Introduction To Code Igniter
Amzad Hossain
 
PPT
Introduction To CodeIgniter
schwebbie
 
Introduction to CodeIgniter
Piti Suwannakom
 
Introduction To CodeIgniter
Muhammad Hafiz Hasan
 
CodeIgniter 101 Tutorial
Konstantinos Magarisiotis
 
Code igniter - A brief introduction
Commit University
 
Codeigniter
minhrau111
 
Benefits of the CodeIgniter Framework
Toby Beresford
 
Introduction To Code Igniter
Amzad Hossain
 
Introduction To CodeIgniter
schwebbie
 

What's hot (20)

PPTX
Codeigniter Introduction
Ashfan Ahamed
 
PPT
PHP Frameworks and CodeIgniter
KHALID C
 
PPTX
yii1
Rajat Gupta
 
PPTX
Yii2 by Peter Jack Kambey
k4ndar
 
PDF
Progressive EPiServer Development
joelabrahamsson
 
PPTX
A site in 15 minutes with yii
Andy Kelk
 
PPTX
Beautiful REST and JSON APIs - Les Hazlewood
jaxconf
 
PPTX
Automated Testing Of EPiServer CMS Sites
joelabrahamsson
 
PPTX
Yii 2.0 overview - 1 of 2
Cassiano Surek
 
PDF
Security enforcement of Java Microservices with Apiman & Keycloak
Charles Moulliard
 
PPTX
MVC - Introduction
Sudhakar Sharma
 
PPTX
What is an API?
Muhammad Zuhdi
 
PPTX
Mule groovy
Sindhu VL
 
PDF
Introduction Yii Framework
Tuan Nguyen
 
PDF
Api presentation
Tiago Cardoso
 
PPTX
Web api
Sudhakar Sharma
 
PPTX
ASP .NET MVC
eldorina
 
PPTX
MVC 6 Introduction
Sudhakar Sharma
 
PPTX
Angular on ASP.NET MVC 6
Noam Kfir
 
PPTX
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed
 
Codeigniter Introduction
Ashfan Ahamed
 
PHP Frameworks and CodeIgniter
KHALID C
 
Yii2 by Peter Jack Kambey
k4ndar
 
Progressive EPiServer Development
joelabrahamsson
 
A site in 15 minutes with yii
Andy Kelk
 
Beautiful REST and JSON APIs - Les Hazlewood
jaxconf
 
Automated Testing Of EPiServer CMS Sites
joelabrahamsson
 
Yii 2.0 overview - 1 of 2
Cassiano Surek
 
Security enforcement of Java Microservices with Apiman & Keycloak
Charles Moulliard
 
MVC - Introduction
Sudhakar Sharma
 
What is an API?
Muhammad Zuhdi
 
Mule groovy
Sindhu VL
 
Introduction Yii Framework
Tuan Nguyen
 
Api presentation
Tiago Cardoso
 
ASP .NET MVC
eldorina
 
MVC 6 Introduction
Sudhakar Sharma
 
Angular on ASP.NET MVC 6
Noam Kfir
 
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed
 
Ad

Viewers also liked (11)

DOCX
Codeigniter
Chirag Parmar
 
PPTX
Introduction to MVC Web Framework with CodeIgniter
Pongsakorn U-chupala
 
PPTX
PHP Frameworks & Introduction to CodeIgniter
Jamshid Hashimi
 
ODP
CodeIgniter PHP MVC Framework
Bo-Yi Wu
 
PPT
MYSQL.ppt
webhostingguy
 
PDF
Introduction to MySQL
Giuseppe Maxia
 
PPT
MySQL Atchitecture and Concepts
Tuyen Vuong
 
PPS
Introduction to Mysql
Tushar Chauhan
 
PPT
MySql slides (ppt)
webhostingguy
 
PPTX
Introduction to codeigniter
Harishankaran K
 
PPTX
Introduction to database
Pongsakorn U-chupala
 
Codeigniter
Chirag Parmar
 
Introduction to MVC Web Framework with CodeIgniter
Pongsakorn U-chupala
 
PHP Frameworks & Introduction to CodeIgniter
Jamshid Hashimi
 
CodeIgniter PHP MVC Framework
Bo-Yi Wu
 
MYSQL.ppt
webhostingguy
 
Introduction to MySQL
Giuseppe Maxia
 
MySQL Atchitecture and Concepts
Tuyen Vuong
 
Introduction to Mysql
Tushar Chauhan
 
MySql slides (ppt)
webhostingguy
 
Introduction to codeigniter
Harishankaran K
 
Introduction to database
Pongsakorn U-chupala
 
Ad

Similar to Having fun with code igniter (20)

PDF
Codeigniter : The Introduction
Abdul Malik Ikhsan
 
PDF
Codeigniter
Joram Salinas
 
PPTX
Codeigniter
ShahRushika
 
PPT
Code igniter overview
umesh patil
 
PPT
Codeigniter simple explanation
Arumugam P
 
ODP
Codegnitorppt
sreedath c g
 
PPTX
CodeIgniter
Sandun_Prasanna
 
PPT
Codeigniter
shadowk
 
PPTX
CODE IGNITER
Yesha kapadia
 
PDF
Codeigniter
EmmanuelMasyenene1
 
PDF
CodeIgniter
Hossein Mobasher
 
PPTX
CodeIgniter & MVC
Jamshid Hashimi
 
PDF
CodeIgniter For Project : Lesson 103 - Introduction to Codeigniter
Weerayut Hongsa
 
PPTX
codeigniter
Utkarsh Chaturvedi
 
PPTX
Codeinator
Muhammed Thanveer M
 
PDF
API CRUD pplg smk kalimantan barat versi 1-1.pdf
filmdownload5
 
PPT
Codeigniter En
shadowk
 
PPT
How CodeIgniter Made Me A Freelancer
Michael Wales
 
Codeigniter : The Introduction
Abdul Malik Ikhsan
 
Codeigniter
Joram Salinas
 
Codeigniter
ShahRushika
 
Code igniter overview
umesh patil
 
Codeigniter simple explanation
Arumugam P
 
Codegnitorppt
sreedath c g
 
CodeIgniter
Sandun_Prasanna
 
Codeigniter
shadowk
 
CODE IGNITER
Yesha kapadia
 
Codeigniter
EmmanuelMasyenene1
 
CodeIgniter
Hossein Mobasher
 
CodeIgniter & MVC
Jamshid Hashimi
 
CodeIgniter For Project : Lesson 103 - Introduction to Codeigniter
Weerayut Hongsa
 
codeigniter
Utkarsh Chaturvedi
 
API CRUD pplg smk kalimantan barat versi 1-1.pdf
filmdownload5
 
Codeigniter En
shadowk
 
How CodeIgniter Made Me A Freelancer
Michael Wales
 

Recently uploaded (20)

PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
PPTX
FSSAI (Food Safety and Standards Authority of India) & FDA (Food and Drug Adm...
Dr. Paindla Jyothirmai
 
PPT
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PDF
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PDF
Sunset Boulevard Student Revision Booklet
jpinnuck
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
PPTX
Trends in pediatric nursing .pptx
AneetaSharma15
 
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
FSSAI (Food Safety and Standards Authority of India) & FDA (Food and Drug Adm...
Dr. Paindla Jyothirmai
 
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
Sunset Boulevard Student Revision Booklet
jpinnuck
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
Trends in pediatric nursing .pptx
AneetaSharma15
 

Having fun with code igniter

  • 1. Have fun with CodeIgniter Framework 23 April 2016 & Ahmad Arif
  • 2. About Me  Pendidikan  1998-2004 SDN 1 Kertamulya, Karawang  2004-2007 SMPN 2 Rengasdengklok, Karawang  2007-2010 SMAN 1 Rengasdengklok, Karawang  2010-2014 Informatika Universitas Jenderal Achman Yani  2015-???? Informatika Institut Teknologi Bandung  Minat  Programming  Machine Learning  Artificial Intelligent  Game Technology  Entertainment  Etc
  • 3. What is framework?  Framework = Kerangka kerja  Menyediakan struktur umum aplikasi sehingga memudahkan pengembang dalam menyimpan kode dalam aplikasi  Menangani tugas umum – Database – Business logic – Form handling
  • 4. What is CodeIgniter?  CodeIgniter framework aplikasi web ringan yang ditulis dalam bahasa pemrograman PHP, dan mengadopsi pendekatan Model-View-Controller.
  • 5. Kenapa menggunakan CodeIgniter?  Feature rich  Lightweight/small  Open source  Well-supported by an active community  Excellent “by example” documentation  Easy to configure (nearly zero configuration)  Supports multiple databases  Cleaner code  High Performance https://github.com/kenjis/php-framework-benchmark
  • 6. Model-View-Controller  Model – merepresentasikan data  View – menyajikan data untuk interaksi dengan user  Controller – mengontrol model dan data supaya bisa saling berinteraksi
  • 7. CodeIgniter Classes  CI’s built-in classes berisi fungsi dasar yang sering digunakan oleh aplikasi web  Beberapa kelas yang sering digunakan: – Database – Input – Loader – URI – Validation
  • 8. Database Class  Mengolah queri menggunakan the Active Record / ORM Pattern  Menyediakan metode “chaining” untuk kemudahan query  $this->db->where(‘name’,$name);
  • 9. Input Class  Menyediakan akses ke input pengguna dan data lainnya: – Form fields (POST) – Cookies – Server variables  $this->input->post(‘fieldname’);
  • 10. Loader Class  Membuat berbagai resource: – Databases – Views – Helpers – Plugins  $this->load->view(‘viewname’);
  • 11. URI Class  Menyediakan akses ke bagian-bagian tertentu dari String URI  Berguna untuk membangung RESTful API  $this->uri->segment(n);
  • 12. Other Classes  Benchmarking  Calendaring  Email  Encryption  File uploading  FTP  HTML Table  Image Manipulation  Language (internationalization)  Output  Pagination  Session  Trackback  Unit testing  XML-RPC  Zip encoding
  • 13. Helpers and Plugins  CodeIgniter dilengkapi dengan berbagai “helper” yaitu fungsi yang menambahkan kenyamanan terhadap aplikasi dan memberikan kemudahan reuse code.  $this->load->helper(‘helper_name’);  CodeIgniter juga memungkinkan untuk penggunaan kustom add-on yang disebut “plugins”.  $this->load->plugin(‘plugin_name’);
  • 14. Getting Started  Tools – Apache HTTP Server – MySQL Database – PHP – Browser – Code Editor XAMP, WAMP, MAMP, LAMPP  Notepad  Notepad++  Sublime  Atom  PHP Storm  Etc
  • 15. Getting Started  To Do List – Installation – Controller – View – Model – RESTful API
  • 16. Controller <?php class BlogController extends CI_Controller { public function index() { echo 'Hello World!'; } public function comments() { echo 'Look at this!'; } } <?php class BlogController extends CI_Controller { … public function page($index) { echo 'Page: !' . $index; } }
  • 17. View <html> <head> <title>My Blog</title> </head> <body> <h1>Welcome to my Blog!<h1> </body> </html> index.php $this->load->view(“index”); Add this code in controller
  • 18. View <html> <head> <title>My Blog</title> </head> <body> Welcome <strong><?php echo $name ?><strong> </body> </html> index.php $data = array( “name” => “Ahmad Arif” ); $this->load->view(“index”, $data); Add this code in controller
  • 19. Model  Create database and table  Setting database (config/database.php)
  • 20. Model class Blog extends CI_Model { $tableName = “blog”; public function insert($title, $content){ $data = array( “title” => $title, “content” => $content ); $this->db->insert($this->tableName, $data); } }
  • 21. Model class Blog extends CI_Model { ... public function update($id, $title, $content){ $data = array( “title” => $title, “content” => $content ); $this->db->where(“id”, $id); $this->db->update($this->tableName, $data); } }
  • 22. Model class Blog extends CI_Model { ... public function delete($id){ $this->db->where(“id”, $id); $this->db->delete($this->tableName); } }
  • 23. Model class Blog extends CI_Model { ... public function getAll(){ return $this->db->get($this->tableName)->result(); } public function getById($id){ $this->db->where(“id”, $id); return $this->db->get($this->tableName)->row(); } }
  • 24. Using Model class BlogController extends CI_Controller { ... public function insert(){ $this->load->model(“Blog”); $title = $this->input->post(“title”); $content = $this->input->post(“content”); $this->Blog->insert($title, $content); } }
  • 25. RESTful API  Tools – Postman – Code Editor  To Do List – Format JSON/XML – Routing – Cache setting

Editor's Notes

  • #9: Chain = rantai