In this post we will see why its important to use a framework for serious development over plain php.
WHY USE A FRAMEWORK OVER PLAIN PHP
Frameworks are organized in such a way that developers can keep there code organized by separation of presentation and logic layer . Presentation layer is done by Frontend developer who does not have anything to do with backend stuff he works with html,css,jquery most of the time . In the below image you will see how views and controllers are separated .
Frameworks follow MVC pattern which separate the layers . Models are object in the web application like Settings Object , Profile Object .Views are presentation layer which shows the visible part to the user .
Controllers are classes which takes the data from Model and pass that to Views . Controllers contain business logic .
In most of the application you will be using Login , Registration , Payment gateways for processing payment , Saving Credit card information for recurring transactions . This type of applications need to be secure from all sort of hacking methods . Why should we recreate it when it have been done by top developers . Frameworks are secure . Frameworks are tailored for security from the ground up
- Filter Input escape output is automatically done for us
- Secure routing for admin and normal users
- Handling CSRF attacks is just changing a option in config
- SQL Injections are very common attacks
- Password Encryption
LIBARIES AND PACKAGES
Framework contains all the packages which are mostly used in web development . Some of the packages are
- Form Builders
- Authentation System
- Email Libraries
- String helpers
If you are used to frameworks you will never be writing a single line of query most of the time in your applications . Frameworks provides ActiveRecord implementation to work with databases so when ever you change database you dont need to change a single line of code . If you want to get all users thats simple just query your models like below
GOOD PRACTICE AND GOOD COMMUNITY
Yes we know how to code but what if there is an alternative way which can improve performance we will surely use that . Good Frameworks have active community , good developers who teach you best practices . Give it a try
In the next few posts i will be writing posts on Laravel and let you feel comfortable with the directory stucture .