Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which PHP framework for a RoR developer? [closed]

For one specific client I have to use PHP. This and this question were 2 years old. I'd like to know is there any update of opinion for year 2010?

My background on web development is mainly rails. I can code in PHP (for example, write a module for Drupal) but never used any PHP framework for any project.

I can see the following potential features to be needed in my project:

  • authlogic-like user access control
  • will_paginate-like paging for long listings
  • paperclip-like simple file upload
  • prawn-like PDF generation
  • restful url

and my personal favorite ruby/rails features:

  • activerecord
  • <% @list.each do |item| %> synstax instead of for ($i=1; $i<=$row_num; $i++) ...
  • rake:db migrate
  • script/console

Thanks!

like image 789
ohho Avatar asked Jun 15 '10 03:06

ohho


4 Answers

Please, for the sake of all that is good and holy, don't write Rails in PHP! Ruby idioms and Rails idioms simply do not translate well into PHP. Hell, until 5.3, you couldn't even do ActiveRecord without insane hackish workarounds due to PHP's limitations.

Try a modern framework like Kohana or maybe something more engineered-OO like Zend Framework. CakePHP tries to be Rails-like, but is stuck in the past of PHP4. Avoid it!

like image 59
Charles Avatar answered Oct 21 '22 06:10

Charles


As said by Charles, don't try to copy what you can do in Ruby with PHP.

That being said, there are several good PHP frameworks. Several have already been given here.
I just want to add Symfony to the list.

It's inspired by Django in many ways. But you'll see several similar ideas taken from rails too.

like image 30
Damien MATHIEU Avatar answered Oct 21 '22 06:10

Damien MATHIEU


I have not found a PHP framework that comes close to Rails.

I have used CodeIgniter on several projects when I have had to develop in PHP, but my approach here is to have a bare-minimum framework and do most of the heavy lifting myself.

I used CakePHP quite extensively and it broke down very rapidly because it thought it could be Rails - Ruby can do some things that are impossible or difficult in PHP quite easily.

My advice is to make sure you charge a premium for the PHP work - it generally takes me 25-50% longer to complete a PHP project.

like image 3
Toby Hede Avatar answered Oct 21 '22 05:10

Toby Hede


I'm not really familiar with PHP frameworks but let me help you out with the transition just a bit:

Ruby/Rails features to PHP:

<% @list.each do |item| %>

is the same in PHP as:

<?php foreach($list as $item): ?>
...(HTML)...
<?php endforeach; ?>

And for script/console you can use PHPSH (developed by Facebook), located at :

http://www.phpsh.org/

Hope this helps! Matt

like image 1
Matt Avatar answered Oct 21 '22 07:10

Matt