21
PHP Frameworks March 19, 2015

PHP Frameworks Review - Mar 19 2015

  • Upload
    kyphpug

  • View
    486

  • Download
    4

Embed Size (px)

Citation preview

PHP FrameworksMarch 19, 2015

Why use a framework?• Common features of web apps are created by the framework so

you don’t have to code them yourself

• Provides predictable locations for the code you write (models are in, duh, the /models directory)

• Enforcing standards

• Allegedly “faster” and “better”

• Your boss or client tells you to

• All the other code at work is written with it

• You enjoy it

YOU ENJOY IT!!!• Unless you need to follow a coding standard that

determines your framework selection (ie, “We’re a Yii shop, by golly!”), personal preference should be your primary selection criteria

• You will code “better” and “faster” if you use tools that you like

• Your code will be “better” and “faster” if you use tools that you like

That’s why we solicited help from people with experience using particular frameworks for today’s talk.

Nothing you read on the internet will help you understand what it’s like to develop with a given framework as well as hearing about it first-hand.

So. Many. Choices.• There are, no kidding, dozens of PHP frameworks.

• They all make similar claims:

• “fast”, “easy”, “secure”, “robust”, “use only those features you need”, “small footprint”, “great documentation”, “vibrant user community”

• The one important claim seems to be “modern”, but I couldn’t find a good definition of that

• Requires PHP 5.3+?

• Templates?

• ActiveRecord

In my googling, these claims stood out:

• Laravel is sexy

• Phalcon is fast

• Zend is slow

• There are lots of webpages that list the top X popular PHP frameworks, but few contain more detail than you can get from the framework homepage (I hate you, Buzzfeed. You ruined the internet.)

• Notable exception: http://www.sitepoint.com/best-php-frameworks-2014/

• Forums seem to be the most prolific source of personal opinions about frameworks…imagine that.

The 8 PHP Frameworks You Have To Learn RIGHT NOW

• Laravel

• Yii

• Symfony

• Silex

• CakePHP

• CodeIgniter

• Phalcon

• Zend

Laravel

(Skaught Bowden)

• http://laravel.com/

• Combines the best tools and philosophies from various projects, to make development faster, funner, and eleganter.

• Symfony packages deep under the hood, where you will likely never see them.

• Eloquent ORM for a very Ruby on Rails-ish data abstraction experience.

• Artisan CLI, notably: access to models. C&P commands into your tests & voilà!

• Database migrations (with improved rollbacks in Laravel 5)

• Composer dependency manager. Don't like Eloquent? Plug in your own ORM!

• You can override or replace almost any component!

• Homestead (pre-fab Vagrant VM) and Forge (Heroku-style hosting) = RAPID.

• LaraCon 2015 will be held in exotic Louisville, KY on Aug. 11–12!

Laravel

Yii

(Christopher Emmick)

Symfony

(Christopher Davis)

Silex (Christopher Davis)

CakePHP

(Anyone?)

CakePHP• http://cakephp.org/

• 2 out of 2 PHP user group organizers think the website is just darling

• Inspired by Ruby on Rails and will feel very familiar to RoR developers

• Was the first MVC framework for PHP

• V3 is a significant overhaul, making CakePHP more “modern”

• Has been criticized for poor documentation and lack of help for newbies, but that seems to be changing (as evidenced by its super-friendly website design)

CodeIgniter

(Anyone?)

CodeIgniter

• http://www.codeigniter.com/

• Was a top contender in the past

• First a licensing model change and then an ownership change may have destabilized the product in the collective mind

Phalcon

(Anyone?)

Phalcon• Unique among platforms in that it is a C extension. You need

to compile it into PHP (or download a suitably compiled binary, which makes things complicated on Windows)

• Wicked fast, since the framework components are inside the PHP executable

• Excellent choice for high-volume applications that will benefit from its speed

• Poor choice for hosted environments where you don’t control the version of PHP or you share resources with other tenants

Zend

(Anyone?)

Zend• http://framework.zend.com/

• Began life as part of the PHP language, was created by core contributors to the PHP language

• Well-established user base (perhaps skewed to enterprise level development)

• Thriving community, excellent documentation, active development (v3 is in the pipeline)

• Historically, has been criticized for having a steep learning curve

• Corporate backing - Zend is maintained by the Zend company, which provides PHP application development products and services (and therefore may be a good choice if you plan to use those products and services)

Summary• Not all PHP frameworks are created equal, but

they share many common features

• So, your choice might have little to do with overall feature set and lots to do with one particular thing a framework does well or a community characteristic, like an IRC channel for instant help

• Distribution license of the framework may matter for your applications (MIT, BSD, etc)