Which PHP framework is most like Ruby on Rails? - php

Which PHP framework should I choose if I want to be able to develop in both PHP and Ruby and Rails without having to make too much of a mental jump when I move from one to the other? It does not have to be an exact copy, but should have most of the basic features of Rails.
That is, it should include similar routing (either /controller/action/id or RESTful); similar model method names (find, findBy); similar helper methods (linkTo etc..); similar validations and similar conventions with regards table names.

CakePHP is essentially a port of ROR to PHP.

Akelos may be what you are looking for.

I would say CakePHP is more Rails-ish in its approach. CodeIgniter is another wonderful PHP framework, but not quite so Rails-ish.

There is also CodeIgniter. Tried it a few years back and I thought it was pretty nice. The documentation is great.

I would say Cakephp, if u have to write an app and coming from Rails, it'll be a lot easier to adjust your development compared to other php frameworks.

Currently, the PHP framework that mimics Rails best must be Maintainable Framework. It is essentially a directly ported version of Rails and features a lot of the goodness from Rails (ActiveRecord, Migrations, generators, routing, view helpers etc.) using the same directory structure, so you should feel familiar. Don't think it is so widely used, though.

Related

PHP framework similar to Python Pylons

What is most similar PHP framework to Pylons?
I mean mostly ideology of programming.
Being primarily a Python developer, and having used Pylons, TurboGears, and Django, I would whole heartedly, 100% recommend Kohana 3.x. To be completely honest I am not a huge fan of PHP, even though it is the language of choice at my current employer. Given the choice I would use Python and Pylons. But, using Kohana is just about the best framework I could hope for from PHP. I hope I am not biases, considering I work with two developers on the Kohana development team. ;-)
PHP and Python are very different. As such, there is no real equivalent of Pylons in PHP. But, I would also say there is no real equivalent of Kohana in Python
Methyl, Great php framework is Codeigniter, fully documented. Also there is Kohana, if you want php5 features.
Regarding your question, Since benchmarking PHP vs Pylons they are comparing smarty with pylons, it might be similar.
I would go for Codeigniter or Kohana. Behance.net is one of the sites build on Codeigniter.
I used Pylons a few years ago. I don't think that there is any web framework in PHP very similar to it.
However, I find that Symfony encourages several web development patterns used in Pylons. For example, in ORM, templating, testing, configuration files, MVC, etc. Some other MVC frameworks that can be compared to Pylons are CakePHP (which is inspired in Ruby on Rails) and the Zend Framework (one of the largest, with lots of components to be extended).

A CMS on 2 DIFFERENT frameworks?

I'm not sure if this is possible, but let's say you want to build a CMS, but you're torn between 2 frameworks because each has some features that you like. Is it possible to create the CMS with both framewoks? Does this approach have merits or pitfalls?
Speaking strictly about the Zend Framework (ZF) I would say yes. ZF components are written to be as independent from other components as possible. I would say that it would not be very difficult (It may actually be quite common) to integrate libraries of ZF into other frameworks like Cake, Symfony, or Codeigniter.
Is it possible to create the CMS with both framewoks?
While it's possible to use components from the Zend Framework inside other Frameworks / CMSs - this may be the case with other component libraries as well, but Zend's the most modular one that I know - It's usually not a good idea to mix two full-blown Frameworks.
Many central functions like MVC structures, URL routing, the database layer, Unit testing, error management and so on are by nature unable to be served by two frameworks at once without massive friction. Also, you're likely to get problems when one of the frameworks needs to be updated.
I would recommend to pick the framework that covers most of what you need, and try and add the missing features using plug-ins or own modifications.
Your question is too abstract.
For instance Zend Framework is more to be a library of specific functionalities ready-to-be-include into Your codebase then some closed development environment like for instance Symfony framework.
Thanks to it can be ZF simply included into your codebase (and Symfony too).
Symfony Framework compared to it is closed solution depending on front server environment so you cannot use it like some other framewor's slave.
It would really depend on which things you liked about both...
Zend Frameowrk is more like a library, so you can pick and choose components from it. Symfony also has some re-usable components you can use.
Really, you can do anything... it just depends how much work you want to do, and how willing you are to modify the framework code. Note: most other PHP frameworks are not nearly as flexible as Zend Framework (next up probably being Symfony).
This sounds very messy, so I'd advise against it, unless you use it in the fashion I've described above. It's easy to pull ZF or Symfony components into other frameworks, but not the other way around.
Hope this helps.
The composability of most frameworks is such that that is most likely to give you all the disadvantages of both, while simultaneously eliminating most of the individual advantages of both.
It seems to me like one framework will for serve as the core - bootstrapping, MVC stack, routing - while the other will be used to pull in specific functionality - like classes for forms or filtering or interacting with web services, etc.
As much as I prefer Zend Framework for the core - and most everything else - its use-at-will architecture argues for making the other framework the core and pulling in ZF components where you need them.
As #Adrian notes, it's easy to pull in ZF components into a project built primarily on another framework, since ZF is designed with that flexibility in mind. Other frameworks are less accommodating in this regard.
You can do it. Most modern frameworks (Zend, symfony, flow) is capable to use parts of other frameworks. Symfony 2 uses Zend Logger, flow3 uses sfYaml... It is possible tu interchange some components.
But, imho, you should stick to one framework as a core, and use second only to relatively isolated subsystems. Adapter and Facade design patterns can help you to mix them together - some components / clases demands some wrapping before use in non-native environment.
For further reading: http://www.symfony-project.org/book/1_2/17-Extending-Symfony#chapter_17_integrating_with_other_framework_s_components
Of course it is possible and I don't see something wrong with it. For example I used CakePHP and Zend on a relatively large Project which was kind of a cms. CakePHP for the core (Routing, MVC) and Zend for some "Modules". Mainly for PDF, E-Mail (smtp), FTP and a few others that CakePHP was not that good at. With Cake it was fairly easy to use ZF components and didn't feel hacky at all.
In fact, ZF was written to be as independent as possible, so that you can use any component at any time anywhere. Yet, it would not work the other way round (Using ZF as core, and Cake components). Surely it is possible, but a real pain with no benefits. So ZF could be used propably inside of pretty much any other framework and nothing would be wrong with it, imho.

Are there any other PHP frameworks like CodeIgniter?

I am looking for a "lite" php framework like codeigniter that doesn't generate anything or make me follow conventions, etc. I have a lot of legacy databases to connect to and I don't know whether or not CI will be able to connect to them all so I thought I'd see if anything else is out there.
Again, not after anything that worries me to death about singular and plural names, makes me have a database in a certain fashion, or anything that gets in my way. No offense by that. I have other projects where that is just fine and I use RoR for that. I just don't want that here because if a framework is built around that like RoR is they tend to be difficult to use with existing legacy databases.
Thank you.
CakePHP is the most popular.
There's a fork of CodeIgniter called Kohana.
The connectivity to the legacy database shouldn't be an issue of the framework though, I guess it's more a PHP issue if the connection won't work.
http://alternativeto.net/software/codeigniter/ Will give you a few alternatives.
Check out Laravel. http://laravel.com/
It is really clean and well documented and has some really useful features which I didn't find in CodeIgniter or CakePHP which I previously worked on. I tried it out for one of my recent projects and I was really impressed !
The Zend Framework might be your best bet:
Zend Framework is an open source,
object oriented web application
framework for PHP 5. Zend Framework is
often called a 'component library',
because it has many loosely coupled
components that you can use more or
less independently.
Since you can use the components independently, you will have more flexibility in choosing your models and data access. Be warned though, there is a steep learning curve.
apparently Qcodo is supposed to be a lot like rails according to http://gadgetopia.com/post/4726
other than that (and symfony, Yii, and CakePHP) if you're comfortable with CI, do go for Kohana, as Cassey mentioned
You could also just use PEAR or some wrappers. if you have legacy databases I wonder if you might have older php/mysql tht it sits on, in which case a lot of the newer frameworks that are updated for the latest/greatest might not work for you anyway.
I'd look at Kohana or Yii. Sure, Yii has scaffolding, but you don't HAVE to use that if you don't want to. Just as with Ruby on Rails.
Both are MVC frameworks that are very object oriented. How you connect to databases is totally up to you.
You can use the ORM in Kohana without following their naming conventions, you just have to let the Models know the name of your tables and primary keys (otherwise you have to follow the convention, of course).
Check out Symfony
The last version is very lite and all extra packages are optional and the core is so lite and also it is so clean and well documented .

Object oriented php CMS or framework

I'm embarking on a very big exercise to build a CMS in php. It's actually my attempt to learn PHP in a fun (and hardcore) way coming from a Java background. Java is all object oriented so oop is in my blood, but I'm finding that OOP hasn't made it yet to PHP. Most PHP is still being written today the old way without the new concepts.
I'm trying to find an example PHP CMS that's written as object oriented. I hear Xoops is. Any others you know of? or any OOP libraries in general that you know of that could help me in a CMS project.
I would suggest symfony framework as it is well documented and functional framework that helped building many web applications.
http://www.symfony-project.org/
PHP5 is pretty OOP. Look for CMSes and frameworks that only work on PHP5. For example, Kohana
Concrete5 is a pretty complex OOP based CMS. Might be a harsh start but I've learned a lot by working with it.
again, +1 for symfony, but this is a large project and getting to know symfony will consume most of your time, yet if you want to dive in, its documentation is really great.
since you are trying to build your own CMS, get started with easy to grasp frameworks and build upon them. Don't waste your time on everything that has been already done. I recommend you Codeigniter MVC Framework http://codeigniter.com and for CMS, PyroCMS http://pyrocms.com which is built upon codeigniter is cool. Codeigniter is really easy to get along, and documentation is very neat and clean.
Further, if you like to start with a simple php framework, here's what Tyrehall has done, http://github.com/tylerhall/simple-php-framework . This project can act as a base for your CMS
No one seems to have mentioned Kohana the PHP 5 only framework.
Kohana has a pretty active and very helpful community to back it up (#kohana on freenode in particular).
edit: Upon closer inspection I see someone has already mentioned Kohana.
what you will notice is that what is more important to most cms (and framework) developers is MVC pattern implementation. Most MVC implementations in php do in fact use oop practices (some stricter than others)
+1 for symfony, and another I'd like to recommend is Kohana (built on CodeIgniter)
Also have a look at their forums, as both already have a cms or 10 built using these frameworks.
Using these frameworks brings you about 60% there, as a lot of the rudimentary tasks are taken care of.
edit
also remebered this one: fatfree framework it's quite lightweight: http://fatfree.sourceforge.net/
Have a look at Phundament 3.
Phundament 3 is an application foundation built upon a set if independent Yii modules and extensions such as user, rights, yiiext, gtc, ckeditor, jquery-file-upload, p3widgets and p3media.
The combination of p3widgets and p3media provides basic content management system (CMS) features, like dynamic widget creation and file management.
Combined in ckeditor, p3media acts as a ckfinder plugin which gives you the full power of HTML and media files for content creation via p3widgets.
It comes with a very minimalistic setup which integrates perfectly into an Yii web application skeletion and installs with one single command.
as some folks suggested here, you should start with Codeigniter because it's really easy to dive in. Its documentation is very well structured and easy to read. But I think Codeigniter seems to be very old now.
What I really recommend to you is Laravel. There's another Framework you should look into, that's FuelPHP. But for me, Laravel has absolutely changed to way I'm writing my PHP code. It is the best framework I've ever seen in my life. It's so elegant that you will instantly fall in love with.
If Laravel suits you, I recommend you to follow this online course by Jeffrey Way # Tutsplus.com. You will love it!
Good luck :)
Have you seen CakePHP?
http://cakephp.org/
Its a MVC framework for PHP. Its pretty robust and can be used in a fully object oriented manner.

What is a PHP Framework?

Ive never heard of this before, and I have been coding in PHP for quite some time. I actually feel kind of stupid asking this question but, what is a PHP Framework? How can it help me? and how do I use one?
A framework in general is a collection of classes and functions that let you accomplish your goal faster in development. PHP Frameworks such as Symfony, CakePHP, and Zend all have a series of utility classes, tools, and structured elements that let you avoid reinventing the wheel.
Zend Framework, like many, has a strong MVC engine that let's you avoid rebuilding that functionality yourself.
To start using a framework, you download the framework itself. In the case of Zend, I download it, unpack it to lib/, and I'm good to go. From there, you just read the documentation on that particular framework to learn how to actually utilize the tools they provide. What functions to use, what classes where, and so on.
A framework is a big library. Exactly where the two differs, is rather fuzzy, but generally frameworks have stronger implications on workflow than libraries do. A (good) library is passive, where a framework is expected to be more involved. Consequently, frameworks are also often quite monolithic (eg. you can't usually use two frameworks together).

Categories