PHP is a server-side scripting language used all over the world for
general purposes. Earlier, PHP used to be the short for Personal Home
Page. It is now known as ‘PHP: Hypertext Processor’. It is very helpful
for web development and can be blended into HTML too.
PHP includes many functions without the need for namespace importing. You can decide whether to write object oriented code or not. The syntax is also similar with weakly typed variables.
The simplicity in using PHP sometimes acts against it. Since there are
very few coding restrictions, developers tend to write a bad code. The
answer to this is definitely to use a framework. There are various of framework are available and some one are freeware like like Zend Framework, CakePHP Framework and CodeIgniter. They provide a
strong organization for your application and follow the commonly used
MVC pattern. and The main benefits of using a php framework I have found are as follows:
-
Time saving - The amount of time saved by not having to
type in complex code in a lot of situations cuts the time of many
projects by over 50% in most cases.
-
Reuse of code - Many web sites that you develop have
common features. Because of the way that each part of the code is
separate, you are able to copy over controllers, models and view folders
to the next project. An example of this is that in every project that
requires a content management system(CMS) we are able to copy across the
login system. Something that used to be quite a time consuming process.
Now we copy it across, and add the users, and we are set to go.
-
Access to services API's - with the way that the web is
moving these days, having the ability to twitter, yahoo and Google
amongst others is a great way of expanding a web site with ease.
-
Community assistance - There is a large community out
there which is always willing to help. When you are proficient with the
framework, you can also assist others, which will also improve your
coding experience.(Not to mention the warm fuzzy feeling that you get
for helping)
-
Easy plugin creation - When you have a feature you want
to add to the framework, just simply create a plugin, in a directory
that you can copy to all your projects. I created a image resizing
plugin, which allows me to upload an image and resize it with 3 lines of
code. Unbelievable, when you consider how long this would usually take
and the best thing is, once I made it, I have this feature available in
all future projects. The time saving benefits can be enormous.
Some of the other advantages of using a framework are:
- MVC structured code:MVC or Model- View- Controller
is a well-known design pattern that demarcates the database and business
logic from the presentation layer. This results in simple, clean and
understandable code.
- Maintaining the coding standards:The MVC code is
easy to write and also follows the code restrictions. Due to a uniform
and standard coding, things are simpler and bugs can be resolved faster.
This will save you a lot of worry and it will be easier to find out
where the problem lies.
- Attractive URLs:Almost all these frameworks
make sure that your URLs look attractive and easy to access. Apache
takes care of requests for a particular URL, which further invokes the
central framework object. The end-users can only see the URL pasted on
their browser, and cannot make out that you are using PHP for the same.
- Get all the help you need:When you use a PHP
framework, you no longer need to manually enter all the validation
criteria for forms etc. The only thing you should do is instantiating a
new form validator object and instruct it as you wish. It will handle
the rest.
- Finish coding faster:Frameworks help the developers
to write code in lesser time than usual. This leaves them with some
extra time for themselves.All said and done, there is always the option
of writing your own framework for your application. However, when you
have something like CakePHP doing a lot of nifty things for you or a
Zend that provides great functionality, you can select one depending on
your requirements. So just choose a framework and start coding!
No comments:
Post a Comment