PHP Framework for form-intensive application - php

I'm looking for a simple-to-learn php framework for an application that is being migrated from Access to PHP. The application has lots of forms (sometimes 50+ fields per page), and lots of the fields are inter-dependent (ie, you change one field, it updates some other fields or options).
Is there any good php framework for this? I would prefer it really simple since:
The devs are not so experienced
The DB is being migrated from Access and was not designed with OOP in mind, it's basically a collection of tables divided by functionality, so I probably don't need any ORM (at least for now).
The most important thing is really the ease of form design and fields correlation (ex: two list boxes where the values of the second depends of the selected value of the first) - I know most ajax libs have some support for this but I would like it out of the box.
edit: As a clarification, the most important is not the ajax nifty stuff, although it is important. The important is a straightforward way to create db-based forms. The db is not designed with an ORM in mind, so I don't need fancy table associations on the ORM layer whith cascade deletes etc. If an ORM layer doesn't get in the way and simplifies the implementation so that's ok but i doubt this will ever be true.

I've just done a similar but much more simple application using codeIgniter, which has a pretty nice form helper
Examples of code:
form_hidden('userName', 'johndoe');
// Would produce: <input type="hidden" name="username" value="johndoe" />
form_input('username', #$_POST['userName'])
// Would produce an input populated with a variable from the post array
And you can do allsorts using arrays etc:
$js = 'id="shirts" onChange="some_function();"';
echo form_dropdown('shirts', $options, 'large', $js);

While I'll certainly add my support behind the excellent and simple to learn CodeIgniter I fear everyone so far is missing the elephant in the room regarding this question.
To be perfectly honest I don't think any framework is going to make assembling an application with 50+ forms per page simpler or easy for Developers without much experience. Especially with the added requirement of ajax ready support for dropdown dependencies.
Having said that, if you're looking for power and flexibilty I'd select Zend. If you're looking for straight simplicity I'd choose CodeIgniter.

Code Igniter has some very good documentation regarding forms and handles a lot of the complexities for you.
The form validation class is documented here: http://codeigniter.com/user_guide/libraries/form_validation.html
There is also a form helper class which makes creating forms very easy.
http://codeigniter.com/user_guide/helpers/form_helper.html
It is certainly easier than building a web app from scratch!
(source: codeigniter.com)

I'm a big symfony fan and it has pretty good support for forms with its form helpers. Check out the docs for forms:
http://www.symfony-project.org/book/1_2/10-Forms

Have a look at Zend Framework, in particular, Zend_Form.
It is enterprise ready, has excellent beginner to advanced tutorials as well as 'official' training courses, and it's free.
You also might want to check out CodeIgniter

the best is, without a doubt, Zebra_Form, a jQuery augmented PHP library for creating and validating HTML forms: provides both server-side and client-side validation (client-side validation is done using jQuery 1.5.2+) and has a lot of predefined rules that can be used out of the box; custom validation rules (including AJAX-based) can easily be added; has integrated cross-site scripting (XSS) prevention mechanism that automatically strips out potentially malicious code from the submitted data, and also features protection against cross-site request forgery (CSRF) attacks; it prevents automated SPAM posts, out of the box and without relying on CAPTCHAs by using honeypots; forms' layout can be generated either automatically or manually using templates; it's easy to learn, mature, and it is constantly improved;

Wow, this question is so outdated! Anyway, I also consider Symfony (SF) to be the best general purpose framework for PHP, however in SF 2.0+ forms are really complex (hence, complicated), and I don't consider Symfony to be a good option for form-intensive app, unless its requirements are quite specific. It's important to realize what you need: if it's the re-use of code (forms in this case), SF is really good, and their approach is very similar to the one took in the Java EE projects. But if you want results fast, I would look elsewhere, perhaps to Javascript frameworks.
If you want to work with JavaScript directly, look maybe at the jQuery Form Framework project.

Leaving general-purpose frameworks aside, for the UI-centric application I recommend ATK UI. It is relatively new (released in 2017) under MIT license. Here is why it's good choice for OP:
Designed for those who don't understand HTML / CSS.
Creating a form takes just few lines of PHP code.
Works with Database or without (up to you).
Handles wide range of types, even file uploads through extension.
Integrated with SemanticUI, fully responsive.
Installation: there is downloadable ZIP at www.agiletoolkit.org or through composer require atk4/ui.
Syntax:
<?php
$app = new \atk4\ui\App();
$app->initLayout('Centered');
$form = $app->add('Form');
$form->addField('name');
$form->addField('date', null, ['type'=>'date']);
$form->onSubmit(function($form){
return 'Hello, '.$name;
});
Nothing else is required, to need to install anything or copy assets, it just works. If you like, there are integrations with WP, Laravel and some other full-stack frameworks.

Related

forms/heredocs versus Ajax versus....? What are 'Best Practices' for interactive website development?

I am unsure about what to use to develop a site for the startup gang I'm working with.
I'm tasked with getting the initial version of the site going.
I am familiar with 2 ways to make a site interactive and responsive to
asynchronous user interaction on the site:
1) Ajax
2) using heredoc and forms technique of calling back to the same PHP file to handle a user's
interactions on a form, such as here:
echo <<<_END
<form action="sqltest.php" method="post">
Enter stuff, okay go for it: <input type="text" name="someInputField" />
<input type="submit" value="ADD STUFF NOW" />
</form>
_END;
What is the most common-in-industry approach for dynamic website coding? Methinks that perhap neither Ajax nor the heredoc is still
the #1 choice for site developers -- I need to make this code up-to-date because when we hire a paid
developer to take over development we DON'T want the guy to tell us "you'd be better off if I re-write the site
using 'X'.
Right now I'm considering using Ajax and XAMPP. But I don't want the hotshot coder we eventually hire to say
"Sure Ajax works, but this technique 'X' is the 'Best Practice' in the industry these days.'
Trying to start our site's initial code base here with the current 'Best Practices' but
I don't know what the best practices are...?
I'm a bit unsure as to what you mean by the 'heredoc' approach. Also, I think this question would be better accommodated on programmers.
At any rate, to answer your question (which is a bit too open ended).
Try to at least organize your project into distinct parts. Use an MVC based approach. You don't need to go full on framework, but layering on a template framework like Smarty will help you a lot. Or you can write your own light layer as well.
As for your front end, code your site to work with basic functionality. Make sure everything works without Ajax/JS. Then start layering on increasing interactivity by using unobtrusive javascript techniques. This will ensure your site gets the widest possible audience while being able to leverage new technologies and methods. You can also use some HTML5 and CSS3 in there as well.
Make sure you use a coding standard and stick to it. If you use a framework, they usually encourage you to stay in character when coding in any case. Lots of popular frameworks are available if you go the framework route. Including, but not limited to Zend, CakePHP, Codeigniter, symfony and many more.
And feel free to use JS libraries to do all the legwork for you. Some of the most popular are jQuery, mootools and prototype
Ajax is fine but consider browsers with no JS (or JS turned OFF) - if You implement AJAX solution You still have to implement standard form submitting...
I've never used heredoc for site developing, instead of this I recommend using of some MVC / MVP frameworks or just the MVC/MVP pattern for application.
These days You can find a lot of frameworks that are good for that or You can use poor PHP and implement in that way...
My approach while using object oriented programming in PHP is to have a class for a form with init method for form and form fields initialisation, view method for displaying of form and a submit method for post data manipulation...
In MVC You'd have to have at least two classes for this -> one for creating of the form, second for data manipulation, one view (.tpl, .html or .phtml template) and maybe a model class when data is stored somewhere...
But this question could be debated for hours with o lots of opinions and argues and with no definitive result...

How to Stop Wasting Time in PHP

As a programmer, I love developing algorithms. I love to take a problem and work out a clean, efficient, readable, elegant solution. I seem to find, however, that the majority of my time is spent validating and cleaning form data, and passing it along to prepare various SQL statements. Perhaps this is "just the way it is" but I suspect I may be doing it wrong.
What do you do to avoid the deathtrap of endlessly validating input and building database interactions? Do you use a third-party library? Write your own library? Or is that simply the way it is?
Most people abstract out a lot of the form validation and database transactions using some kind of framework. One example is the Zend framework Forms. I've seen people write their own libraries to add similar functionality.
For example, I've written my own simple library for smaller clients as well (just making each form element it's own class with a Basic "element" base class), a set of validation classes, and a Form class to wrap the elements. The form class calls the validate methods for each element and turns their data into an array that can be fed to a database class.
Your best bet is to figure out the needs for the websites and forms you are building. (Complex forms may be too difficult to abstract out). But simple forms could have their coding process stream lined without much difficulty.
If you're not using a framework (or can't), then you should definitely check out the php Filter methods: http://php.net/manual/en/book.filter.php
They're built in as of PHP 5.2
I've yet to see a good DB extraction outside of a framework, but the PDO abstraction layer is a good start ( http://php.net/manual/en/book.pdo.php )
P.S. I use Drupal too, when I can. The webform module in particular makes all this ridiculously easy.
I use Drupal for that, but you may prefer using some framework.

Best high level Web framework, PHP preferred

I'm starting to architect a quite complex web application. The implementation is probably going to be done in PHP, though if there are impressive reasons to choose a different environment I might be convinced.
I've looked at tools like Symfony and CakePHP. The problem is that it feels like they're relatively low level for a modern Web 2.0 application. They handle the basic things like MVC and scaffolding, but not the more advanced UI elements that I'm looking for. Here are some of my requirements:
Single page architecture. With minor exceptions, there should be no page refresh. All actions are done via ajax, the way it's done in gmail, and to a lesser extent in Facebook.
Ajax layout and widget handling. Not only the application doesn't refresh the page, but the developer can specify the layout and load various widgets into different parts of the page. This is somewhat like iGoogle, but should be better integrated.
Support both on the client side and server side for AJAX widgets. It should be trivial to display the result of a select statement in an AJAX table/array like http://developer.yahoo.com/yui/datatable/. This should also apply to other widgets including
Trees
Menus
Forms
Speaking of forms, there should be easy integration with client side validation
Signup/Authentication/Authorization. Including all the housekeeping things like forgot my password, CAPTCHAs, etc.
There's more, but I think I've given enough details so that you get an idea for what I'm looking for. Basically, I'd like to engineer a modern Web 2.0 app and skip writing, testing, debugging things that most web applications need to do. And yes, I know I can take YUI or jQuery and slap it on top of one of the regular platforms, but then I'd have to write all the glue. Now if there are modules that do this, that would be interesting.
So if you say, take Symfony + modules xyz + jQuery and there's your answer, I'd be happy to hear that.
Finally, in terms of priority, I'm looking for something that's scalable, reliable, well engineered more than something that's easy to learn and deploy.
Since you are looking for all things AJAX, why not try GWT? Its not PHP I agree, but it makes writing AJAX applications easy for developers.
I agree with #Iznogood. What your looking for is not actually a framework but a talent.You can make any framework as "igoogle-ish" as possible if you know what your doing.
I suggest look for a framework with a huge and active community like, CI, Cake and Jquery. Search/ask the community for the specific things you need. Plug it in and Presto!
But I'm afraid you'll have to write some of it.
If you don't mind using Java, there is ZK:
http://www.zkoss.org/
I'd prefer using this over GWT.
In php, you might want to consider Cjax http://cjax.sourceforge.net/.
It is MVC oriented, and has a very generic API, with full support for customization, including the development of plugins (There is a full Plugin API available, including documentation, Plugins can be built in PHP and JavaScript in combination -- see uploadify and validate plugins).
It can access all JavaScript functions, Objects and proprieties, and elements properties and functions from PHP server side, with one line of code.
In Cjax,
you can execute ajax actions, inside controllers (ajax requests) - without a line of JavaScript. this allows you to fully function without refreshing the page. It also allows you to access all Js objects from PHP. A good sample that reflects this is the "recursive ajax request" see that demo. The API can be used on page load, when the page first loads, and within every single ajax request.
Do take a look at the documentation and to the 20+ demos included, and no where you will see a single line of JavaScript. It allows you to manipulate elements, containers, request ajax, submit ajax forms, creates overlays, upload files through ajax, all from the server side. Take a glace at the API Table.
It has support for both, server side ajax, and client side, (see plugins JavaScript Documentation)
It plays nice with jQuery - the validation plugin in jquery is full executable in PHP without a line of JavaScript (see http://cjax.sourceforge.net/examples/plugin_validate.php without any custom line of Jquery inside the framework, it's all plugin's work). Ajax Responses from Jquery also get processed by this framework automatically, so using Jquery's Ajax function API wise, is the same as if you were using the Framework's Plugin's JavaScript Ajax Functions.
And you would just have to take your time learning more about it, because it has quite a few more tools that I am sure you'd find useful.
Currently there are two official releases, the generic release and
there is an official release for CodeIgnater of this framework (and it is the leading ajax option for codeignater) , and works great in conjunction other PHP Frameworks and without them.
Signup/Authentication/Authorization. Including all the housekeeping
things like forgot my password, CAPTCHAs, etc.
This is something that you can build within an ajax controller, the framework itself its meant to be a generic "AJAX" framework, so if you are looking for none ajax features, you will need to build them or integrate other PHP Framework with Cjax (such as Codeignater).
I do not know if this matches all of your criteria, or if you ever will find one. However, I like the Zend Framework myself.
As for the UI and AJAX portions - the server side technology matters little, and it's more about browser-side technology and interaction mechanisms, as well as DOM manipulation.
jQuery is my favorite for that. As for the PHP back-end, I tend to develop it with my own codebase that's grown with me over the years.
But all this takes a lot of practice, knowledge, education, research, reading, and posting questions on StackOverflow.com ;)
I would recommend symfony PHP framework since it has very good support for every feature you mentioned, and it can be easily integrated with Zend Framework - as of version 2.0 coming this year it would be integrated in the package. You can easily set symfony to handle AJAX requests so that it would be perfect transparent layer handling server side.
For me, if you look at THAT heavy AJAX, I would recommend searching for some good JavaScript framework - such as Ext.JS - that would handle all client side functionalities.
For the front-end part of your app, you might want to have a look at SproutCore ( http://www.sproutcore.com/ ).
Building a Web application with SproutCore feels more like configuring components than writing code.
There is no glue code.
On the backend all you have to do is accept and emit JSON.
Depends what sort of level you're looking at. If by 'framework' you mean something like Zend or Symphony, then to be honest all the big ones are about as good as each other. They all have strong points and weak points, but none will really meet your criteria.
But your question implies you're looking for something more than that kind of framework. Maybe you're looking for a full-blown CMS platform like Drupal, Joomla or Wordpress?
In that case, again, you need to consider your needs verses the capabilities and pitfalls of each system.
Drupal, for example, has masses of modules, is very powerful, and easy to write your own modules, but isn't object-oriented and doesn't really do MVC, so if that's your bag then you may find it hard to get on with. Wordpress is much easier to get going quickly but is less flexible once you start getting deeper into it.
But again, they all have strengths and weaknesses. If one was clearly the best, it would be an easy choice. But at the end of day perhaps it's better to have several good quality options to choose from.
Have a look at Ext JS, it is pretty good. If it is a commercial project you are doing it isn't free but not too expensive either. It also has a GWT version if you prefer that.
This is only for the front end but it is not too complicated to use any backend that can emit json.
CakePHP is pretty good

program/site to generate html form code based on mysql database

I have a mysql databased with many tables and fields. I would like to quickly generate a set of prototype forms based on the mysql database (or create table statements). Anyone have any suggestions? html form code would be great. Full PHP validation and insert updates would be even better. Also Zend framework code would be ideal.
I was looking at mySQL workbench which has an excelent reverse engineering and visual presentaion of databases, but no form generator.
You're looking for a thing called scaffolding.
Scaffolding is a meta-programming method of building database-backed software applications. It is a technique supported by some model-view-controller frameworks, in which the programmer may write a specification that describes how the application database may be used. The compiler uses this specification to generate code that the application can use to create, read, update and delete database entries, effectively treating the template as a "scaffold" on which to build a more powerful application.
Please note that ZF and other PHP frameworks are not MVC frameworks - at least those popular like ZF, Symfony, Kohana, CakePHP etc.
It seems that ZF has built-in support for scaffolding: Zend_Controller_Front_Scaffold.
well, what you want is a little too much specific (not saying that it doesn't exist). maybe this could help you with the boring task of writing the html tags:
http://code.google.com/p/zen-coding/

Why is Zend Framework so popular?

I'm not a troll and my goal isn't to start a flame war; neither do I mean to disrespect the authors of the Zend Framework: there is a lot of fine work in it. But... I have a job to get done and I'm having a hard time reconciling the popularity of ZF against the reality of building apps with it. I would really like to know from others why they use Zend Framework.
I am fairly new to the PHP world but I've done a lot of programming in many languages. After reading many tutorials and building a couple of apps in it, some core Zend Framework facilities feel like alpha code to me. For me the following fundamental weaknesses, among others, would seem too overwhelming to consider deploying apps with it - but over and over again ZF is suggested as one of the, if not the leading framework.
First let me say I find the much of ZF to be workable. Routing works pretty much as it should, the Layout facility is serviceable (though very different from templating systems such as JSP/ASP), as is the cache facility, etc. There seems to be a tendency in the community to stuff a lot of modeling (e.g. validation) and view logic (e.g. $this->headScript() - why should my controller have to care which js file my view requires?) into controllers but could be a matter of usage and not necessarily the framework's fault.
Now for a couple of really serious (IMO) weaknesses I've experienced in my short time with it. I shudder to imagine the other areas I will discover in the future if I continue to build with it.
1. Form Layout
Many people seem to be unhappy with the lack of control over form layout. How can you have a popular framework where constructing a simple form requires so much discussion?
Question 1 and question 2.
2. Authentication/Authorization
No one really seems to understand how to simply perform routine authentication/authorization. People [including yours truly] struggle with implementing simple access control. Further, the approach seems to lean on serialization for persistence, rather than traditional database storage of users and permissions.
A confusing example, a proposal to enhance the facility, a tutorial - part I,
and part II. This is too much work guys!
Are my perceived weaknesses not real or somehow not a problem? Why or why not? Why did you choose Zend Framework (or not)? Are there other areas that you've found to be so painful that you want to dump ZF for a different approach? Thanks for your opinions.
Because they are good at Marketing
Zend's founders Andi Gutmans and Zeev
Suraski are key contributors to PHP
And they have one of the most complete framework for php.
When you think about it; it's like saying:
"Our language isn't as performant as it could be, so we made a framework with caching that makes it faster"
Most of what Zend offer, can be done
without Zend.
But Zend's package is a very good
"All in one" distribution.
They offer certifications and trainings.
One of the main benefits of ZF is that you can take any one of it's components and easily tie them in with your own (or a third party) framework with minimal modification.
Forms: The decorator approach is complicated, but bulletproof and priceless for applications with many forms. You don't care if you have 10 or 25 items in your form, the style is always the same. Saves you a great deal of work when you know how to use it.
For users with simplier minds and goals there is always the viewScript decorator ;)
Auth/Acl: Never had any problems with these.
Zend_Auth::getInstance()->hasIdentity() //logged in
and
Zend_Auth::getInstance()->getIdentity()->role; //returns admin
For Acl:
$acl->isAllowed($who, $where, $what);
$acl->isAllowed('roleAdmin', 'resourcePosts', 'create'); //returns true
Can be easily modified to match MVC:
$acl->isAllowed('roleAdmin', $module.ucfirst($controller), $action); //returns true
$acl->isAllowed('roleAdmin', 'adminPosts', 'create'); //returns true
Color me UNIMPRESSED with ZendFramework. Using Zend Framework is like welding a set of training wheels to your code. Anything you can do in Zend Framework is something you can do in raw PHP. (Remember ZF itself was written in raw PHP.) And you can usually do it with the same number of lines of code - written in a consistent style with the rest of your application. And, by using native PHP code, you're not locked into a niche tool that only a minority of PHP developers use. And you don't have to worry about compatibility with changes in ZF versions.
In my applications, I do all the same things that the ZF tools do, mostly by using simple PHP functions that have been around for years:
validate form data
cleanse form input
handle files uploaded through forms
manipulate and compare dates
handle authentication
send emails
write to log files
read from configuration files
read external HTTP pages
exchange in JSON and SOAP formats
work with third-party APIs
I can't find much of anything in Zend Framework that is worth my time. And don't get me started on overbearing "scaffolding" frameworks like CodeCoffin, AppShackler, or Ruby in Chains.
ZF is a good starting point. I used zend_tool to generate a MVC skeleton of my middle-size application and used many other components (Zend_Cache, e-mail, translate, forms, session).
And I agree that form layout is complicated if you are trying to do it as Zend says - with decorators. There are ways to use just Zend_Form elements with validation and in your custom layout - without decorators.
I had a bad experience with Zend Cookies - I just could not set a cookie for my entire domain. Old good setcookie did the trick right.
About Acl - again, examples in Zend documentation and Zend_Acl do not work well sometimes. I used Controller plugin approach and my own "role based resource management" to control permissions.
I did not even try Zend Data Gateway - used Doctrine instead (I guess that is because I like nHibernate :) ) And connecting Doctrine was really easy.
I think ZF is good because you can use it as you like. I think it would be harder with some other frameworks.
Simplicity to build medium size applications.
Until ZF you had to build your own "framework" to do medium size applications. Now is much more simpler.
I don't think decoupling and simple elements that can be used independently is the key to success. Is a nice feature, but is not the regular use.
Support and community size are relevant in the balance with other frameworks.
In terms of speed they are NOT better then other frameworks.
Wel, we are developers because we are supposed to be able to write "some" of our own code, arn't we? Frameworks not supposed to be wizards, just an added assistance.
I did not choose Zend Framework because at the time when I was evaluating PHP frameworks it was not a complete and integrated enough solution for building web apps. I chose symfony and since then I have never had a need to switch to anything else.
I'm not sure if it's the same nowadays, but I always thought of ZF as a component library rather than a framework. A framework has a somewhat more strict rules of doing things and often has better integrated support tools to help people do them. A component library is more loose in this regard. When the framework rules correspond to the requirements of most applications in the framework's domain, I myself clearly prefer this solution. This has been the case with symfony for me. I do use certain ZF components as needed, but never base my projects on ZF itself.
I use ZF for a few reasons:
The host of nifty classes, lazy loading of classes, stand-alone usage of classes, and clean clear source. The first time I used it I needed to build an ACL system - a very big complex one. Zend_Acl helped tremendously.
I think ZF needs to work on it's docs and db classes. The db classes problems have a lot to do with PHP itself. So maybe it's some thing Zend wants to look into.
The OP is new to PHP. I agree PHP has it's flaws such as the arbitrary naming of functions, but generally it does make sense for HTTP and doesn't hide reality from you.
Form layout:
It's really easy. Decorators are a pain in the butt during your first contact with them, they're just black magic. Then you realise how useful they are and that you can do almost anything with them. When you finally hit a point where decorators are just not enough, you can just render separate form elements in your view or even write your own form HTML. Consider this example:
form
$text = new Zend_Form_Element_Text('text');
$text->addValidator('NotEmpty')->setRequired();
$submit = new Zend_Form_Element_Submit('submit');
view
<form>
<input type="text" id="text" name="text" />
<input type="submit" id="submit" name="submit" value="Send" />
</form>
controller:
$form = new Form_Whatever();
if ($this->_request->isPost()) {
if ($form->isValid($this->_request->getPost()) {
// code
}
}
There you go. You have a form, you wrote its HTML manually, but you still benefit from ZF's inbuilt validation. Why? Because you still create the form object in the controller and feed it the data sent via POST. You still get your filters, validators, anything you want. With any HTML you want. And you can also plug an external view to the form if you want to go extreme :).
Oh, by the way, did you know that your forms are reuseable? Yeah, you can write one form and use it in multiple places. No hassle. That's what I personally like about forms in ZF (and dislike in CodeIgniter - which is a great framework too, by the way).
Authentication:
Zend Framework: Login password hash, email validator?
Yes, it's only a small piece of code. You basically copy and paste it in your projects.
As for ACL, you just create your rules and then check them whenever you need them. A one liner. Can't be simpler.
Personally, I think ZF is popular because it simply saves your money. If you put me in front of a project, I can guarantee you that I'll finish it twice faster if you let me use ZF instead of another framework I know. And probably a fraction of the time I'd need to do everything in baseline PHP. So that's about it: saving time = saving money. Or earning you extra money - but either of the two rules, right?
There is no need to use Zend_Form or Decorators themselves. You can just use plain HTML Forms and then inside Controller=Actions use Zend_Filter_Input like this. So you have best of both Worlds.
public function indexAction()
{
$this->view->title = 'Search Results';
$filters = array('q' => array('StringTrim' , 'StripTags'));
$validators = array('q' => array('presence' => 'required'));
$input = new Zend_Filter_Input($filters, $validators, $_GET);
if ($input->isValid()) {
$this->view->messages = '';
$q = $input->getEscaped('q');
$this->view->q = $q;
// do search
try {
$index = News_Search_Lucene::open(
SearchIndexer::getIndexDirectory());
$results = $index->find($q);
} catch (Exception $e) {
$results = array();
}
$this->view->results = $results;
} else {
$this->view->messages = $input->getMessages();
}
}
I'm not sure if ZF is really the most popular PHP framework. I chose it after comparing it with other frameworks that do more stuff "magically" because they all seemed to hard to customize.
I think ZF is a good object oriented PHP MVC framework, but I don't agree with some ZF approaches. For example, I only use Zend_Form for filtering and validate data. All the HTML and presentation stuff are done at view scripts. The CSS is the responsible for the layout. If we need some changes most of the time changing only the CSS is enough. If I need to make the same form appear in many pages, I use it as a partial view script.
I don't like to have to write a Mapper for each Model and to create a Zend_Db_Table subclass for each database table. Instead I'm researching how to use other patterns for data access, or maybe Doctrine.
What I don't like about Zend_Acl is that stores the ACL information in the ACL file. I would like to store that information in the database.
The good thing about this framework is that is easy make things your way.
In addition to the previous answers, it is worth mentioning that in a recent pool at DZone titled Which PHP framework would you use today for a brand new application?, Zend Framework was selected to be the most preferable for new projects.

Categories