As I'm new to PHP previously i worked on JAVA, currently for my web application i'm using codeigniter. I want to configure a filter where i can filter every request to identify whether any harmful data is coming from user or not(same as java filter).
Codeigniter have Security and Input Class, Look:
http://ellislab.com/codeigniter/user-guide/libraries/security.html and
http://ellislab.com/codeigniter/user-guide/libraries/input.html
AFAIK, That's all you can get. CI is just a small (IMO) Framework. If you want more, you need to create your own by creating library and/or extending the core.
I'm eying the Yii PHP framework for a new project, but after going through a few demos and checking out the code I'm noticing all javascript is generated through Yii functions. Is there anyway to override this? I really want to be able to write my own javascript for sections of the project, specifically for a map based search piece that requires a lot of javascript. Is this possible and is it worth using Yii for a project where I'll have to write a ton of my own javascript for a few sections of the project?
Of course you can write a ton of Javascript yourself if you cannot or do not want to use the built-in widgets; but many times "writing your own" might turn out to be subclassing a widget so that you can extend it or just writing your own widget from scratch. In my experience being able to have Javascript be auto-generated from a higher-level specification you provide (i.e. configuring a widget) is very desirable.
From your question though it seems that there are specific cases of automatic Javascript that look troubling -- can you perhaps update with specifics?
While Yii has helpers that generate some JavaScript code for you, nothing prevents you from including code of your own in your output.
I have just about got my head around how JavaScript frameworks like Backbone.js and Spine.js deals with the client-side state of a data model in regards to updating views etc. I am looking to build a web application with Backbone that syncs its model with a database. Most of the examples out there use Ruby, but I am currently much more comfortable writing PHP. I have experience with MySQL and MongoDB.
I am looking for a very basic, stripped down version, of a RESTful web application that uses Backbone and syncs with a database through PHP. I have found tutorials like this one and this one, however, even these are too complex for me to learn from.
It would be nice to have a very basic example. For example, a HTML form input, and a list. Enter into the input to add to the list. Of course, this data model will be synced to a database (preferably MySQL). Would anyone be able to provide me with the code for this example? I am comfortable with using a PHP framework like Slim also.
Once I understand how to sync created data to a database, I can then begin to grasp the rest (CRUD). I have seen very few tutorials out there on how to this at a basic level with PHP, so hopefully any support will benefit others too.
Have you seen this one from net.tuts? I think they will post a new tut soon with more details
Edit
And there are at least 2 similar questions here actually:
simple PHP code sample to serve backbone.js
Backbone.js How to use with PHP
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/
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.