PHP Frameworks: choosing one

I have a small project that I need to demo. I also want to learn PHP frameworks to get me in the right frame of mind to examine Ruby/Rails and/or Python/Django. From what I’ve found there are several PHP frameworks to choose from:

  • Zend Framework 2/3
    • It looks nice. it would not surprise me if it ties strongly into Zend Studio, which I don’t use. I don’t enjoy learning too many things at once, so I’ll pass.
  • CodeIgniter 2.2
    • Also a possibility, but it seems too allow too much. MVC encouraged, but not forced. Simple tempting allowed, but add-ons built to allow work with templating engines. This time, I do want to see a framework’s creation of MVC. Maybe next time.
  • Symfony
    • I like the idea of having a framework and stand-alone components (if needed). However, I see Twig used as the template engine. I am comfortable with Smarty and want to learn one new thing at a time. Maybe next time.
  • Laravel
    • This looks really good. It uses “Eloquent”, which is an ActiveRecord (Ruby/Rails) implementation in PHP. ActiveRecord makes CRUD so much easier.
    • It uses migrations. That’s a concept I first saw in Ruby/Rails, which acts something like version control for databases. Very, very cool for testing.
    • On the other hand, it uses Blade template engine. I’ll deal with a new template engine another time
    • Mcrypt required as part of the list of running php extensions. My stock version of php does not have Mcrypt installed. Installing it seems like a pain, so I’ll pass this time.

I’m going to try CakePHP for this small project. It has the MVC framework that I’ve used informally in the past. It can integrate nicely (I’m told) with Smarty. All I need to do now is install it.

Advertisements

PHP Frameworks: Installation

I chose CakePHP as the framework I wanted to test. (Reasons in another post.) Both Laravel and CakePHP strongly suggest installation with Composer. That’s a dependency¬†manager for installing PHP applications. I use brew as my¬†package manager for OS X. I’m thinking “use brew to install composer and we’re done”. Well, not so fast.

Using brew to install composer globally does not appear to work, since brew includes some version of PHP as a dependency to install composer. I already have the stock version of PHP installed on this box. Brew won’t recognize it as part of its install, which makes sense.

It’s possible to install composer locally into a project directory. I don’t want to keep installing composer locally on each project directory that I need to create

. The composer installation instructions say that composer can be installed globally and then update the PATH variable to include the composer directory. Brew is supposed to handle that. If I’m going to stick with brew, then I should keep using it.

A google search finds two options: installing php along with composer or installing composer without dependencies. I don’t like the idea of installing php again. I could go the whole MAMP route if I’m going to install php again and it would be easier. I’m going to try installing composer without dependencies and see what happens.

update 1: it did not work

I’m going to tap into additional formularies to see if that works. I’m going to try

>brew tap homebrew/homebrew-php

>brew tap homebrew/dupes

>brew tap homebrew/versions

and see it works.

update 2. This seems to have worked

> composer –version

returns

> Composer version 1.0.0-alpha0 2014-12-07 17:15:20