Version
1.6.3 (today 08/10/2008)
Server Requirements
HTTPD เช่น Apache 1.3 ขึ้นไป
- mod Rewrite
- allow to use .htaccess
- PHP version 4.3.2 or newer.
PHP Module : (เป็นโมดูลที่ผมใช้ สำหรับคนอื่นก็แล้วแต่นะครับว่าจะใช้อะไรบ้าง)
- php_gd2
- php_curl
- php_mbstring
- php_mysql
- php_pdo
- php_pdo_mysql
- php_pdo_sqlite
- php_sockets
- php_sqlite
Database is required for most web application programming. Current supported databases are MySQL (4.1+), MySQLi, MS SQL, Postgre, Oracle, SQLite, and ODBC.
CodeIgniter at a Glance
CodeIgniter is an Application Framework
CodeIgniter is a toolkit for people who build web application using PHP. Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task.
CodeIgniter is Free
CodeIgniter is licensed under an Apache/BSD-style open source license so you can use it however you please. For more information please read the license agreement.
CodeIgniter Runs on PHP 4
CodeIgniter is written to be compatible with PHP 4. Although we would have loved to take advantage of the better object handling in PHP 5 since it would have simplified some things we had to find creative solutions for (looking your way, multiple inheritance), at the time of this writing PHP 5 is not in widespread use, which means we would be alienating most of our potential audience. Major OS vendors like RedHat are moving slowly to support PHP 5, and they are unlikely to do so in the short term, so we felt that it did not serve the best interests of the PHP community to write CodeIgniter in PHP 5.
Note: CodeIgniter will run on PHP 5. It simply does not take advantage of any native features that are only available in that version.
CodeIgniter is Light Weight
Truly light weight. The core system requires only a few very small libraries. This is in stark contrast to many frameworks that require significantly more resources. Additional libraries are loaded dynamically upon request, based on your needs for a given process, so the base system is very lean and quite fast.
CodeIgniter is Fast
Really fast. We challenge you to find a framework that has better performance than CodeIgniter.
CodeIgniter Uses M-V-C
CodeIgniter uses the Model-View-Controller approach, which allows great separation between logic and presentation. This is particularly good for projects in which designers are working with your template files, as the code these file contain will be minimized. We describe MVC in more detail on its own page.
CodeIgniter Generates Clean URLs
The URLs generated by CodeIgniter are clean and search-engine friendly. Rather than using the standard “query string” approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a segment-based approach:
example.com/news/article/345
Note: By default the index.php file is included in the URL but it can be removed using a simple .htaccess file.
CodeIgniter Packs a Punch
CodeIgniter comes with full-range of libraries that enable the most commonly needed web development tasks, like accessing a database, sending email, validating form data, maintaining sessions, manipulating images, working with XML-RPC data and much more.
CodeIgniter is Extensible
The system can be easily extended through the use of plugins and helper libraries, or through class extensions or system hooks.
CodeIgniter Does Not Require a Template Engine
Although CodeIgniter does come with a simple template parser that can be optionally used, it does not force you to use one. Template engines simply can not match the performance of native PHP, and the syntax that must be learned to use a template engine is usually only marginally easier than learning the basics of PHP. Consider this block of PHP code:
<ul>
<?php foreach ($addressbook as $name):?>
<li><?=$name?></li>
<?php endforeach; ?>
</ul>
Contrast this with the pseudo-code used by a template engine:
<ul>
{foreach from=$addressbook item=”name”}
<li>{$name}</li>
{/foreach}
</ul>
Yes, the template engine example is a bit cleaner, but it comes at the price of performance, as the pseudo-code must be converted back into PHP to run. Since one of our goals is maximum performance, we opted to not require the use of a template engine.
CodeIgniter is Thoroughly Documented
Programmers love to code and hate to write documentation. We’re no different, of course, but since documentation is as important as the code itself, we are committed to doing it. Our source code is extremely clean and well commented as well.
CodeIgniter has a Friendly Community of Users
Our growing community of users can be seen actively participating in Codeigniter Community Forums.
CodeIgniter Features
Features in and of themselves are a very poor way to judge an application since they tell you nothing about the user experience, or how intuitively or intelligently it is designed. Features don’t reveal anything about the quality of the code, or the performance, or the attention to detail, or security practices. The only way to really judge an app is to try it and get to know the code. Installing CodeIgniter is child’s play so we encourage you to do just that. In the mean time here’s a list of CodeIgniter’s main features.
- Model-View-Controller Based System
- PHP 4 Compatible
- Extremely Light Weight
- Full Featured database classes with support for several platforms.
- Active Record Database Support
- Form and Data Validation
- Security and XSS Filtering
- Session Management
- Email Sending Class. Supports Attachments, HTML/Text email, multiple protocols (sendmail, SMTP, and Mail) and more.
- Image Manipulation Library (cropping, resizing, rotating, etc.). Supports GD, ImageMagick, and NetPBM
- File Uploading Class
- FTP Class
- Localization
- Pagination
- Data Encryption
- Benchmarking
- Full Page Caching
- Error Logging
- Application Profiling
- Scaffolding
- Calendaring Class
- User Agent Class
- Zip Encoding Class
- Template Engine Class
- Trackback Class
- XML-RPC Library
- Unit Testing Class
- Search-engine Friendly URLs
- Flexible URI Routing
- Support for Hooks, Class Extensions, and Plugins
- Large library of “helper” functions
Application Flow Chart
The following graphic illustrates how data flows throughout the system:
- The index.php serves as the front controller, initializing the base resources needed to run CodeIgniter.
- The Router examines the HTTP request to determine what should be done with it.
- If a cache file exists, it is sent directly to the browser, bypassing the normal system execution.
- Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security.
- The Controller loads the model, core libraries, plugins, helpers, and any other resources needed to process the specific request.
- The finalized View is rendered then sent to the web browser to be seen. If caching is enabled, the view is cached first so that on subsequent requests it can be served.
Large Project Case Study
http://www.noknok.in.th/ (Thai)
http://www.focusshot.com/ (Thai)
http://travel.tarad.com/ (Thai)
http://www.snippr.de/
http://www.moddb.com/
http://www.gold.org/
http://www.campuslive.com/
http://www.opensourcefood.com/
http://www.motortopia.com/
http://www.invenso.com/
http://www.importgenius.com/
http://patterntap.com/
http://www.miolos.com.br/
see more http://codeigniter.com/projects/
Testimonial
“CI is perfectly fine for big projects.” By inparo
http://codeigniter.com/forums/viewthread/82002/
“Ci is totally perfect for big project if you know how to use it well.” By sikkle
http://codeigniter.com/forums/viewthread/82002/
“CI is fine for ‘big’ projects.” By GSV Sleeper Service
http://codeigniter.com/forums/viewthread/82002/
“I have a number of uber-large PHP projects, some in production, some in development, that have been built with CI. Most involve databases with more than 250 tables, and probably about 50 different controllers, etc. I know that is hard to use as a benchmark for big projects, they are projects that have 1-2 yr development cycle on them, so they are pretty huge.” By Myles Wakeham
http://codeigniter.com/forums/viewthread/82002/P15/
กรณีศึกษา : เปลี่ยนจาก Prado มาใช้ CodeIgniter
http://www.narisa.com/forums/index.php?showtopic=21291
CodeIgniter, the most simple
http://weblog.punneng.com/2007/1/18/codeigniter-the-most-simple
Fueled by CodeIgniter
http://suksit.com/node/142
Optimizing and Scaling your CodeIgniter Application – with Benchmarks!
http://www.haughin.com/2008/02/13/optimizing-and-scaling-your-codeigniter-application/
CodeIgniter is the fastest PHP framework
http://amiworks.co.in/talk/codeigniter-is-the-fastest-php-framework/
Kohana vs CodeIgniter: Speed and Memory Usage Performance Benchmark
http://thislab.com/2008/03/25/kohana-vs-codeigniter-speed-and-memory-usage-performance-benchmark/
PHP framework comparison benchmarks
http://www.avnetlabs.com/php/php-framework-comparison-benchmarks
Conclusions
ส่วนตัวผมเพิ่งใช้งาน Framework เป็นครั้งแรก ที่ผ่านมาก็จะทำการเขียนโค้ดแบบเพียวๆ หรือที่เรียกกันว่า Hard Code นั่นเอง
ดังนั้นเมื่อผมเริ่มรู้จัก PHP Framework ทำให้ผมเลือกที่จะเล่น CI ด้วยเหตุผล
- เร็วมากกกกกก!
- เล็กมากกกกก!
- แรงมากกกกก!
- สามารถแก้ไขปรับปรุง Framework ตามที่เราต้องการได้ง่าย เพราะโค้ดเขียนมาแบบง่ายๆ
- รู้ PHP + OOP อีกเล็กน้อย ก็ใช้ CI ได้สบายๆ
- ถ้าไม่รู้โครงสร้างการเขียนแบบ MVC ก็สามารถเขียนถึกๆ แค่ C กับ V ก็ได้ ไม่ fix
- ถ้าขี้เกียจอ่าน Manul มันว่ามี Library ให้ใช้บ้าง ก็ยัดโค้ด PHP + Function ปกติไปได้เลย
- มันมี Active Record ให้ใช้ ทำให้การทำงานกับฐานข้อมูลเป็นเรื่องสะดวก, เร็ว, ปลอดภัยขึ้นอีก (จริงๆ เรื่องของ ORM มันมีหลายยี่ห้อที่ทำมา Support แต่ผมยังไม่ได้ลอง แต่เจ้า Active Record มีติดมาให้ในตัวต้นฉบับเลยครับ)
- มี Library พื้นฐานครบตามต้องการ จะมีนอกเหนือจากนั้น ก็สามารถไปหา Library Third Party มาผสมได้ไม่ยาก ถ้าหาไม่ได้ก็ไปโหลด Class มา include แบบถึกๆ ก็สามารถใช้ได้
- ทำ URL Friendly ได้ง่ายดี
- ทำ Caching Page แบบง่ายๆ ได้ (ถ้าจะให้ดีคงต้องไปผสมกับ Smarty ซึ่งมี Library รองรับอยู่เช่นกัน)
- ทำ Caching Database แบบง่ายๆ ได้ด้วย
- ถึงแม้จะไม่มี AJAX ผสมมาด้วย แต่เราก็สามารถนำมาผสมใช้ที่หลังได้ เช่น jQuery, XAJAX
จะว่าไปแล้ว ถ้าใครไม่ต้องการความเลิศหรูอลังการ และต้องการ PHP Framework แบบพอเพียง ผมว่า CI เป็นตัวเลือกที่ดีมาก
แต่ตรงจุดนี้เอง ผมไม่สามารถฟันธงได้ว่า สามารถรองรับเว็บไซต์ขนาดใหญ่ได้แค่ไหน แต่เท่าที่ตามอ่านข้อมูลในเว็บไซต์ พบว่ามันรองรับการทำงานระบบใหญ่ๆ ได้
แต่ในความส่วนตัวผมมองว่า ด้วยความที่ตัวมันเล็ก จึงทำงานได้เร็ว บางทีผมก็คิดไม่ออกว่าจะต้อง Optimize ที่ไหน เพราะมันเขียนมาง่ายมากๆ ไม่ซับซ้อน ดังนั้น ด้วยความที่เป็นอย่างที่ผมกล่าว การจะเขียนให้รองรับเว็บไซต์ขนาดใหญ่ ตัว Framework เองจึงไม่น่ามีปัญหาใดๆ แต่จะขึ้นอยู่กับผู้เขียนมากกว่าว่าจะเขียนให้มันทำงานได้ดีได้เร็วแค่ไหน
สรุปแล้ว ถ้าใครจะใช้ Codeigniter ไว้เพื่อจัดระเบียบโค้ดให้มันแยกเป็นส่วนๆ ของการทำงานตามแบบ MVC ไว้ช่วยเหลือเรื่อง URL Friendly และช่วยเหลือเรื่องการ Optimize Code ในภายหลัง (เข้าไปเปลี่ยนโค้ดใน CORE ตามแบบฉบับของเรา) ผมว่า มันเหมาะมากเลยหละครับ
อ้างอิงข้อมูลเกี่ยวกับ CI จาก http://codeigniter.com/user_guide/
4 Responses
njoyz
11|Oct|2008 1มีบล๊อคที่เม้นท์ได้มั้ยฟิว ><’
แวะมายิ้มละกานนน้า ^ ^
njoyz
11|Oct|2008 2ออ หมายถึงบล๊อคที่จอยพอจะเม้นท์ได้หนะ..
อันนี้มันอ่านแล้วไม่เข้าจาย เม้นท์มะด้าย T_T
ฟังเพลง เนื้อเพลง
18|Sep|2009 3หาข้อมูลเรื่อง CI แล้วมาเจอ อิอิ ขอบคุณค่ะ
โปรแกรมเมอร์(จำเป็น)
30|Sep|2009 4มีประโยชน์มากเลยครับ ขอไปศึกษาหน่อย เขียนแบบถึกๆ มาซะนาน
Leave a reply
Search
Pages
Category
Recent Posts
Recent Comments
Tags
Archives
barcamp
CSS
Link
Management
MySQL
Online Maketing
PHP Ajax
Thinking
Tools
Meta