Tag: PHP Links

Popular PHP Frameworks: What’s Your Fav?

What is Your Fav PHP Framework?

View Results

Loading ... Loading ...

I have touched on PHP frameworks before that has sparked up a lot of discussion.  A lot of people swear by one framework and other developers another.  Before you first get into one you might want to ask yourself if you need to use a PHP framework.  You might not even need to use one.  But the fact is that over time, they can significantly reduce development time.

Okay, so let’s say that you are new to PHP frameworks.  There are a few popular choices out there to sink your teeth into, but which one?  You don’t want to pick a framework to spend days upon days learning the architecture, only to find out that no other PHP developers out there are using that framework.  Thus making the time you spent learning the framework’s ins and outs a waste of time.

In a perfect world, I would suggest to learn them all!  However, there are only 24 hours in a day, and prioritizing your PHP framework education might be a good idea. So above I added a poll that I plead to other PHP developers out there to vote on.  Hopefully after a lot of participation we will see the most popular PHP framework.

Remember, BrownPHP is a site that helps other PHP developers.  By us learning what the most popular PHP frameworks, it will allow us to become more efficient, and ultimately more successful!  If you do feel strongly about one PHP framework over another, please leave a comment and explain why you chose the PHP framework that you did.

Do You Really Need a Framework for Writing PHP?

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.

Moreover, it is easy to learn. 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 PHP Frameworks available today like Zend Framework, CakePHP Framework and CodeIgniter. They provide a strong organization for your application and follow the commonly used MVC pattern.

Some of the other advantages of using a framework are:

  1. 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.
  2. 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.
  3. 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.

  4. 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.
  5. 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 items matching your keywords were found.

Zend Framework vs CakePHP Framework

The Zend Framework, developed by Zend Technologies is an open-source, object oriented web-application framework implemented in PHP 5. It is widely known as ZF and is developed with the purpose of making things easier for PHP developers and supporting best practices at the same time. CakePHP too, is an open-source web application framework used for creating web applications written in PHP. It is developed by Cake Software Foundation, Inc. It is written in PHP and is based on the model of Ruby on Rails.

Zend Framework has easy methods of licensing with the new BSD license and a swift and well-tested code base that your business can rely upon. It makes use of commonly available APIs from well known vendors like Google, Amazon, Yahoo!, Flickr and API providers and catalogers such as StrikeIron and Programmable Web.

ZF offers a simple component library to provide 80 percent of the functionality mostly needed by developers. The rest of the 20 percent can be altered as per your requirements of the business. This can be done since it has a flexible architecture and you do not need any configuration file to get started with. Due to this, training costs are lessened and the product reaches the market sooner. Moreover, Zend Framework also offers:

  • AJAX support through JSON, which offers ease-of-use of the framework.
  • The PHP version of the Lucene Search engine.
  • Simple access to data formats needed in Web 2.0 applications.
  • The ideal destination to utilize and publish web services.
  • Top quality, object-oriented PHP 5 class library.

CakePHP is a rapid development framework for PHP that offers a flexible architecture for development, maintenance and deployment of applications. It uses the usual design patterns like MVC and ORM within the convention over configuration paradigm that helps lower development expenses and does not need the developers to write a lot of code. CakePHP boasts of clients like Mozilla Addons, Scratch by MIT, Yale Daily News, Onion Store and MapMe to name a few.

Just like ZF, CakePHP does not require configuration. It is very simple to use. The company has a user friendly community called #cakephp on IRC that helps new users to begin. It is distributed under the MIT License and promises Best Practices like security, authentication and session handling. It has an object-oriented approach to keep you at ease.

Overall, both these frameworks are good to use as per your requirements. CakePHP is suitable for developers new to MVC and those who require stricter conventions. ZF is a choice for those who need better control over the application design and built-in support for renowned Web services. Both the frameworks are developing fast and the choice is entirely yours.

Email Made Simple with the Zend_Mail Tutorial

I just got finished with an update to one of my sites, the Informative Post, which uses the Zend_Mail component frequently.  Zend_Mail is a component that is apart of the Zend Framework, and if you haven’t ever used it, now is as good of a time as any!

It is my first time working with Zend_Mail and I must say that I am impressed.  This component alone would influence me to use the Zend Framework.  It makes emailing from your site so simple.  You don’t have to deal with the HTTP headers or anything.  Let me show you the code that I used to send a simple email notifying a member that I have received an article that they just submitted.

include_once 'Zend/Mail.php';

$subject = 'We Have Received Your Article';
$fromEmail = 'admin@gmail.com';
$fromName = 'Administrator';
$toEmail = 'author@email.com';
$toName = 'Author Name';
$message= <<<EMAIL
Hi $toName!

I just wanted to notify you and let you know that I received your article and it will be reviewed shortly.

Douglas Brown
Follow Me On Twitter: http://www.twitter.com/dlbrown06

$mail = new Zend_Mail();
$mail->setFrom($fromEmail, $fromName);
$mail->addTo($toEmail, $toName);

It is as simple as that.  Not too bad is it?  You can also send an HTML email.  It is just as simple.  You would just add setBodyHtml($messageHTML).  $messageHTML would contain the HTML and text that you would like to email.  You should still add the setBodyText method so that if someone who opens up their email doesn’t not want to display the email in HTML, they have the alternative to view it in plain text.

Zend_Mail Tutorial Conclusion

I know that you are thinking that this is a relatively short tutorial, and your right!  The Zend Framework’s Zend_Mail is very simple to use with a minimal amount of code to produce to let you take better advantage of your available time.  You can send an email in 6 lines of code if you would like!  If you feel that I made a mistake in the above code or that you have a better method to use, please let me know, as I would love to learn how to use this component more efficiently.

In my next post, I am planning on showing you how to use the Flickr API to bring your photos to your own site with ease! (continue reading…)

  • BrownPHP Tag Cloud

  • Copyright © 1996-2010 Brown PHP. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress

    Powered by Yahoo! Answers