Mar 29

Keep your projects up-to-dated. Step 1

Not sure how about you but I’ve been working with symfony 0.6.3 during quite a long time. I woked up one morning and said to myself – hey you need to upgrade. So I wrote before about the way of warrior – how did I upgrade my symfony 🙂

And the next related question is what should I do with my old projects. Sure thing I could have 2 symfony installations and sure thing it’s not neccessary to upgrade your projects. But.. If you have time and willing – why not?

First of all please pay your attention to a wonderfull wiki article:

But in my case I’d preffer to build up my old projects from scratch and probably implement the features which propose newer symfony version.

So lets the war begin!

I did the commands:

symfony new project

symfony app frontend

symfony app backend

Of course, I want to use the latest sfGuardPlugin (I never used it in my projects before, so that’s a good chance to taste it)

symfony plugin-install

The next step is how to be with my DB? Older symfony 0.6.3 did not support YML format.
You can build it up automatically. Go there and modify a couple of lines:


propel.database.createUrl = mysql://userdb:[email protected]/

propel.database.url = mysql://userdb:[email protected]/dbname

and now run this command:

symfony propel-build-schema

Yuppee! You have your schema.yml in config/ folder. Sure thing you would need to modify it a bit to make it more readable but lets leave it for now.

We have installed sfGuard plugin. So lets prepare it for using with our project and feed it up with at least admin/admin account:

symfony propel-build-all

symfony propel-load-data backend

Now go to the following files and modify them a bit (I promise it will be really fast!):


class myUser extends sfGuardSecurityUser




class: sfGuardBasicSecurityFilter



url: /login

param: { module: sfGuardAuth, action: signin }


url: /logout

param: { module: sfGuardAuth, action: signout }


url: /request_password

param: { module: sfGuardAuth, action: password }




enabled_modules: [default, sfGuardGroup, sfGuardUser, sfGuardPermission, sfGuardAuth]


login_module: sfGuardAuth

login_action: signin

secure_module: sfGuardAuth

secure_action: secure

/apps/backend/config/security .yml:

is_secure: on

So you have your backend protected and moreover you have ready management UI for users/groups/permissions:

That’s all for today folks! Thanks for your comments. I’ll be waiting for newer ones.

Author: symfonian

1 Comment(s)

March 29, 2007

It’s nice to have a simple set of steps for implementing sfGuard, thanks. By the way, I recommend using some kind of syntax highlighter so your PHP and YML code is more easier to read. (now it blends in with the rest of the posts so it’s kinda hard to read).

Comments RSS TrackBack Identifier URI

Leave a comment