By Alvie Amar | 7/31/2016 | General |Beginners

What is a PHP Framework?

What is a PHP Framework?

A PHP framework is a platform that provides basic structure that allows building web applications written in php. PHP frameworks promotes Rapid Application Development (RAD) which helps developers save time, reduce code repetition, and build stable applications rapidly.

 

Without a PHP framework, there would be a lot of PHP code repetition and developers would need to set up the database connection from scratch. using a PHP framework allows one to build an application that ensures proper database connection while saving time and code.

 

PHP frameworks often use an MVC (Model-View-Controller) architectural pattern which separates the business logic from the (UI) user interface. In MVC, M - Model refers to the data,  V - View refers to the user interface or the presentation layer, C - Controller refers to the business logic which handles the exchange of information between the model and the user interface. MVC basically separates the development process. Therefore the developers can work on the business logic while the designers can work on the user interface separately without getting in each other's way. Once the MVC process is already understood, building applications with a PHP framework will be faster and less complicated.

 

Here are some factors to consider when choosing a PHP framework to work with:

  • The PHP version the framework was created in
  • If the framework uses composer, an important dependency tool in PHP
  • Testing ability of a framework, test coverage
  • Databases supported by the framework
  • Clear and well written documentation
  • Does the framework have an active and large community of users.



What are PHP framework classifications?

 

PHP frameworks can be classified as full-stack frameworks or micro-frameworks.

 

A Full-stack framework provides everything a developer needs to build an application but this does not mean that you can’t extend it or add anything to it that might make it easier to build the application. For example you can use AngularJS for the front-end using the Laravel PHP framework.

 

Anything that is not a Full-stack framework is called “non full-stack framework”. If a non full-stack framework is less than 5,000 line of code in size then it is “micro-framework”.

 

A micro-framework has less components compared to a full-stack framework. For example some micro-frameworks by default, don’t have database layer abstraction and form validation or anything else that a full-stack framework already have.

 

A micro-framework is extensible even though it has less components, it can extend to different libraries that allows to add functionality to your application. For example if a library for form validation already exist, you could extend it to a micro-framework and use its functionality in your application as if it were implemented to the micro-framework itself.



When to use full-stack framework and micro-framework?

 

A full-stack framework is good to use in building medium to large scale projects. It should have everything you need to build an application, and while perhaps lacking in flexibility, it will make building the application easier and reduce code repetition.

 

On the other a hand micro-framework is good for building small projects that only need specific features and need to be finished quickly. A common misconception is that micro-frameworks are only intended for small projects, but this is not necessarily true. A micro-framework could also be used for large application—the term “micro” simply means that it does not have all the libraries, helpers and configurations of a Full-stack framework.



PHP Full-stack framework and micro-framework Examples

 

Here are some examples of Full-stack framework:

  • Laravel

Laravel

    • Laravel uses some Symfony components.
  • CakePHP

CakePHP

    • Web framework modeled after the Ruby on Rails concept.
  • FuelPHP

 FuelPHP

 

    • Configuration over convention Web framework.
  • Kohana

Kohana

    • HMVC framework, a fork of CodeIgniter originally named BlueFlame.
  • Yii

Yii

    • Web framework, redesigned and rebuilt version of Prado Framework.
  • PhalconPHP

PhalconPHP

    • Web framework implemented as web server extension in C.
  • Simple-Mvc-framework

Nova Framework

    • The new name for Simple mvc framework is Nova Framework.

 

  • ThinkPHP

Think PHP

    • A chinese PHP framework
  • Zend Framework

Zend framework

    • Web framework written in PHP5, also called component library.
  • PHPixie

PHPixie

    • HMVC Framework, started as a fork of Kohana Framework.
  • AuraPHP

AuraPHP

    • Full-stack framework built on Aura library packages.
  • Flow

Flow

    • Web framework designed as a base of the CMS TYPO3 Neos.
  • CodeIgniter

codeigniter

    • Web framework from EllisLab.
  • Nette

Nette

    • Full-stack framework made of decoupled and reusable components.
  • Symfony

Symfony

    • Set of PHP components. Inspired by RoR, DJango and Spring.

 

Examples of micro-framework:

  • Silex

Silex

    • Silex is made based on Symfony
  • Slim

Slim

    • PHP micro-framework that features HTTP request and response.



Conclusion

 

PHP frameworks are a great help in building web applications. Their use speeds up the development process by reducing code repetition while avoiding the risks of having messy code. It also helps reduce security risks by ensuring proper coding.

 

Using a PHP framework for creating applications could be advantages when rapid development is required, for example when a small amount of time is given to finish the project. It also promotes good coding practices which can help in enhancing a developer’s skills.

 

For smaller projects that requires rapid development, a micro-framework could be a good fit. Large scale projects like a large e-commerce site should be build with full-stack framework.

 

There are plenty of PHP frameworks to choose from so one should consider the requirement of the project, how large the project is, the time needed to build the it and the programmer’s familiarity with the framework. But whichever you choose, you should definitely be using a framework for your next PHP project.

By Alvie Amar | 7/31/2016 | General

{{CommentsModel.TotalCount}} Comments

Your Comment

{{CommentsModel.Message}}

Recent Stories

Top DiscoverSDK Experts

User photo
3355
Ashton Torrence
Web and Windows developer
GUI | Web and 11 more
View Profile
User photo
1490
Ronan McCarthy
Cross-Platform & Web developer.
Web | Mobile and 6 more
View Profile
User photo
1230
Gary Green
Expert programmer, Ask what you want
Web | JavaScript and 3 more
View Profile
Show All
X

Compare Products

Select up to three two products to compare by clicking on the compare icon () of each product.

{{compareToolModel.Error}}

Now comparing:

{{product.ProductName | createSubstring:25}} X
Compare Now