madarve
madarve

Reputation: 61

Using Symfony's sfForm standalone, without the rest of the framework

I've seen some posts and questions regarding this: how can I use Symfony's sfForm as a standalone library?

Just for managing a simple "hand-made" form but without the bulk of the framework.

Upvotes: 2

Views: 943

Answers (2)

Francesco Terenzani
Francesco Terenzani

Reputation: 1391

Just to complete this topic that is well ranked in Google. You can use any 1.x Symfony class without the whole MVC architecture: http://symfony.com/blog/the-symfony-1-1-architecture

So:

<?php
require_once '/path/to/sfCoreAutoload.class.php';
sfCoreAutoload::register();

class MyForm extends sfForm 
{
// ...
}

Upvotes: 0

0x6A75616E
0x6A75616E

Reputation: 4716

The practicality of the Symfony forms module is actually its integration with the rest of the framework - especially with the object model and the routing system. The forms module is useful because it can build your fields automatically based on your schema and because it integrated with the routing module for creating and updating. There is little point to using the forms without the rest of the modules.

That said, it is possible that Sensio will eventually release some sort of forms component which may or may not be based on sfForm as a stand alone component in http://components.symfony-project.org/.

If what you're looking for is abstracting the creation of the form's markup, then you can look into something like this http://phpformgen.sourceforge.net/.

Upvotes: 1

Related Questions