I've been looking into learning a PHP framework lately and have spotted these three popular choices. They all seem to have similar approaches and methods, and I'm not sure where to begin. If you are or have been using either one I'd greatly appreciate any pros, cons or other info you might want to share about them.
I'm considering these frameworks with the following in mind:
- Which one has best multi-lingual support?
- Which is the easiest to implement / start out with?
- Which is the most future-proof and versatile (i.e. working with NoSQL databases such as MongoDB)?
I have been using all of the mentioned frameworks, but I really enjoy using the codeigniter framework, because it is very lightweight and does not interfere with my workflow in doing too much things I don't want.
The i18n and multi-lingual support is really simple, there is a helper and a class ready to use.
Codeigniter has also pretty much support for any database you may want to use. If you happen to use a database that isn't supported, you can easily write your own database driver, just take a look at one of the driver files.
It is also very easy to integrate other external libraries e.g. Doctrine, adodb into your project.
Related
Is it possible to use Laravel alongside another php application not built with a framework just for the login/authentication system?
Looking at other posts, I realize that's not the point of php frameworks, but my thought was for maximum security, using a framework would be best.
It's entirely feasible, yes. Especially if said application was properly classed and namespaced.
If it's not classed / namespaced, that rules out simply including it in Laravel. That'd likely be way more headache than it's worth.
In terms of security, there are a lot of routes you can go. In fact, there are authentication websites that take user information completely off of your hands. It may be worth looking into them.
The easiest solution would be to either find a class or library that is dedicated to authentication, and simply include it in your application (example here: http://ulogin.sourceforge.net/ or simply search for PHP Authentication Library). They're framework agnostic, and will be very simple to integrate into your project.
The bottom line is, you probably want something that's agnostic to frameworks / coding architectures. That'll be the easiest to integrate into a custom project.
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 .
I'm trying to create an online dictionary (some rare languages) and need you suggestions.
My php, mysql and javascript knowledge though is far from excellent, but is enough to understand the code and make some changes to it. I've done some projects with Drupal before and now thinking about trying a php framework for this project, because I belive that php framework could be more flexible in this case. I don't have any experience with any frameworks. The project isn't commercial, more like a hobby.
So, the question is - Is it worth trying a php framework or should I stick with Drupal? Maybe, some other options?
Thank you.
Some people thinks that writing your own engine instead of using a CMS is not worth.
But if you use a framework, such as Zend Framework, Symfony, CakePHP, CodeIgniter, etc... you will be able to have a robust basic engine which could be extended to your needs, and get improved with time.
With time, you write your own library which you know, and, the most important, which fits to your specific needs.
So, try to find the tool before to write it, but write it you was not able to find it, or it was not adapted to your needs, or adapting it will you cost you extra times.
Think of the following things :
Is the template engine will let me able to design anything I want
Is the software enough modular to let me able to develop plugins or new modules
Is it worth to learn how to use it ?
Is it activly developed, and documentation is available ?
Will it cost me extra time to develop with it instead of writing it from the scratch and create my own library ?
And probably others things i forgot.
Since you mention PHP, why not consider Mediawiki (the engine behind Wikipedia) ?
There's always Wiktionary, if it's an open project that you're working on.
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).
Most of my experience is on the MSFT stack, but I am now working on a side project, helping someone with a personal site with cheap hosting that is built on the LAMP stack. My options for installing extras are limited, so I'm wondering about how to write my data access code without embedding raw queries in the .php files.
I like to keep things simple, even with .NET. I generally write stored procedures for everything, and I have a helper class that wraps all calls to execute procedures and return data sets. I'm not looking for a full-blown ORM, but it might be the way to go and others who view this question might be looking for that.
Remember that I'm on a $7/month GoDaddy account, so I'm limited to what's already installed in their basic package.
Edit: Thanks rix0rr, Alan, Anders, dragon, I will check all of those out. I edited the question to be more open to ORM solutions, since they are so popular.
ActiveRecord seems to be the state of the art at the moment. I can't recommend any good PHP frameworks for that though. I tried Propel which, while nice, is not easy to set up (especially on a host that you can't install anything on).
Ultimately, I rolled my own ORM/ActiveRecord framework, which is not too much work and very instructive. I'm sure other people can recommend good PHP frameworks.
Take a look at the Zend Framework, specifically Zend_Db. It has a Database Abstraction layer that doesn't require anything other than the MySQLi extension to be installed and isn't a full-blown ORM model.
Maybe Doctrine would do the job? It seems to be inspired by Hibernate.
rix0rrr hit on it a bit, in that many tools are a pain to set up. Of course, I have my own solution to this problem that has been working quite well for the past few years. It's a project called dbFacile
I also wrote a bit of a usage comparison of the tools I found a few years ago. It's incomplete, but might give you a good starting point.
You mentioned that you don't want to embed raw queries but you don't want ORM, so I'm a bit confused about the middle ground you're hoping to find. I also have an ORM project that aims to require minimal setup and great ease of use.
The only requirement for my projects is PHP5.
I would try a framework. Zend Framework has been cited. Symfony seems interesting. It's based on ideas from Ruby on Rails.
You could also take a look at Prado. http://www.pradosoft.com/ It uses Active Record and DAO. Also if you use .Net then some of the formatting and conventions are similar.