PHP Framework
จาก Wiki2
เนื้อหา |
What is Framework
- PHP Framework คือ Library ซึ่งสามารถเรียกใช้ได้ ทำให้ลดเวลาในการเขียนโปรแกรม(Rapid Application Development) ไม่ต้องเขียน Code ซ้ำแล้วซ้ำอีก ลด Error และมีโครงสร้างที่ดี (Model View Controller = MVC)
- PHP Framework มีหลายตัว หากเลือกใช้ตัวใดตัวหนึ่งแล้วต้องพยายามเรียนรู้ และไม่เปลี่ยนไปเปลี่ยนมา เพราะการใช้ Framework ก็ต้องเสียเวลาเรียนและทำความคุ้นเคย
When Should we use PHP Framework?
หากคุณต้องการเรียน PHP หรือใช้ PHP ทำงานง่ายๆ เพียงสอง สามงาน คุณอาจไม่จำเป็นต้องสนใจ PHP Framework เพราะอาจเสียเวลา ระบบทำงานช้าและสร้างความซับซ้อนให้งานของคุณ
แต่หากคุณรับทำเว็บ หลายๆงาน หรือทำระบบใหญ่ๆ ต้องการลด Bug ต้องการทำงานให้เร็ว ไม่ต้องการเขียน Code ซ้ำซาก ไม่อยากเสียเวลาสร้าง Library เอง คุณก็น่าจะเสียเวลาในการคัดเลือก และเรียนรู้ Framework ซึ่งจะเป็นคู่มือของคุณ และทำให้คุณลดเวลาในงานต่อๆไปได้ ซึ่งมีมากกว่า 20 Framework ให้เลือก
สำหรับผมชอบทำเว็บจาก Joomla จากนั้นเขียน Extension และ Template เพื่อให้ Joomla ทำงานได้อย่างใจ และ Joomla ก็เป็น Framework ที่ช่วยให้เขียนโปรแกรมได้เร็วขึ้นเช่นกัน จึงไม่ต้องใช้ Framework อื่นอีก ซึ่งมีบางคนพยายามเอา CakePHP มาใช้ใน Joomla เช่นกัน
Framework benefit
- Better structure (MVC)
- Enforcing of Good Coding standards
- Functionality ที่เขียนเองได้ยาก
- Pretty URLS
- RAD เขียนโปรแกรมได้เร็ว
- ลดงานซ้ำซ้อน ลดเวลาเขียนโปรแกรม
ข้อเสียของ Framework
- ระบบทำงานช้ากว่า
- เสียเวลาเรียนรู้และจดจำ
Framework Selection Factors
- Database Support
- Community Support
- Documentation Support
- Model View Controller Architecture
- ความเร็วในการทำงาน
- ความยากง่ายในการใช้งาน และการเรียนรู้
- ใช้ Convention VS Configuration
- พวก Convention เช่น CakePHP, Kohana, Codeignitor , Akelos
Common Mistakes in choosing a Framework
- เล็กเกินไป
- ทำโดยคนที่ไม่เก่งพอ ทำงานผิดพลาด
- ไม่มี Support ชุมชนที่ใช้และให้ support มีน้อย
- ไม่เข้ากับ Web Server หรือ Web Hosting เช่น PHP และ Database Version
Framework ที่น่าสนใจ
- Kohana : Being a PHP 5 Framework, Kohana offers flexibility and community support, an easy learning curve, is nicely structured and comes with multiple session drivers.
- CodeIgniter : CodeIgniter is another PHP framework that brings versatility to the table and has a very small footprint. It's developed primarily for PHP coders with all sorts of experience who need a more simple solution to building web applications.
- Akelos : Akelos is very similar to a Ruby on Rails (RoR) framework only for PHP. It makes building web applications less complex and benefits a more simpler web server.
- CakePHP :CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. Using commonly known design patterns like MVC and ORM within the convention over configuration paradigm, CakePHP reduces developmental costs and helps developers write less code.
- Zend Framework : The Zend Framework is an object-oriented framework written strictly in PHP 5. It's simple, easy to work with, and has a loose architecture that lets you use various Zend components to enhance your applications functionality.
- Symfony :The Symfony PHP Framework holds a library of various classes written in PHP 5. Architecture, useful components and excellent tools are provided for creating complex web apps.
- Prado :PHP Rapid Application Development Object-oriented; PRADO is a component-based and event-driven programming framework that helps you build applications based on PHP 5.
- Solar Framework :Solar is a PHP 5 framework for web application development. It is fully name-spaced and uses enterprise application design patterns, with built-in support for localization and configuration at all levels.
- Yii PHP Framework : Yii is a high-performance component-based PHP framework that's a good choice for developing large scale apps. It's loaded with great features and was written in OOP (which requires PHP 5 and above).
- Maintainable :The Maintainable PHP Framework was formally built to host its creators personal projects. However, it was further released to open source. Like any framework, it's certainly not appropriate for every application. It's designed primarily for use with small-to-mid-sized applications.
- Seagull :Seagull is a mature OOP framework for building web, command line and GUI applications. Licensed under BSD, the project allows PHP developers to easily integrate and manage code resources, and build complex applications quickly.
- Fuse :FUSE is a Model View Controller framework for PHP. Taking influence from other web frameworks; such as Ruby on Rails (RoR) and CakePHP, then adding in custom, intuitive features of our own design, FUSE has developed into a robust, stable platform for MVC development using object oriented PHP.
- AjaxAC :AjaxAC is an open-source framework written in PHP, used to develop/create/generate AJAX applications. The fundamental idea behind AJAX (Asynchronous JavaScript And XML) is to use the XMLHttpRequest object to change a web page state using background HTTP sub-requests without reloading the entire page. It is released under the terms of the Apache License v2.0.
- Phocoa :PHOCOA (pronounced faux-ko) is PHP framework for developing web applications. PHOCOA's primary intent is to make web application development in PHP easier, faster, and of higher-quality.
- Limb : Limb is an OpenSource (LGPL) PHP framework mostly aimed for rapid web application prototyping and development. The current actively developed branch of framework is Limb3 (there is also Limb2 but it's not maintained anymore).
- Zoop : Zoop has been in development since 2001 and in use for the last 6 years in a number of different production environments. While it predates the recent proliferation of PHP frameworks, it's based on solid MVC principles, including separation of display, logic, and data layers. It's designed to be efficient, modular, and extensible; striking a balance between lightweight and fully-featured.
- BlueShoes : BlueShoes is a comprehensive application framework and content management system. It is written in the widely used web-scripting language PHP. BlueShoes offers excellent support for the popular MySQL database as well as support for Oracle and MSSQL.
- Qcodo : The Qcodo Development Framework is an open-source PHP framework that focuses on freeing developers from unnecessary, tedious, and mundane coding.
- Recess : Recess is a RESTful PHP framework that provides a fun and enjoyable developmental experience for beginners and seasoned developers alike. Recess is fast, light-weight, and has a very small footprint ideal for LAMP development and drag-and-drop deployment to shared hosts.
- PHPDevShell :As the name suggests, PHPDevShell provides a shell for your code to run in. It was developed from the ground up to be fast, secure and to provide immediate results for the developer using it. Simply plug your own PHP scripts into PHPDevShell’s secure menu system, or take the extra step and develop your own plug-ins for PHPDevShell.
