Using Yii as a PHP framework


I want to build a new social networking website called Speedy Net. I want to use PHP, Javascript and MySQL (LAMP), but I need to decide if I want to use a PHP framework. someone recommended to me Yii framework. I would like to know what are the advantages and disadvantages of using a PHP framework such as Yii? I want to develop the website as quickly as possible, but I also want to design it specifically, for example all URLs should be short and never contain the .php extension (for example and not ). Each user will be able to create pages with usernames, under the main website (for example ). I wrote more details about the website in the open discussion forum on sourceforge

[ https://sourceforge…s/forum/1321736 ], if you want you can read it there and participate. Also, I need more programmers. If you want to participate, please contact me by email or write on the forum.

I have another question - how do I implement the URL in PHP using the Yii framework? I want to create some pages, for example , but users will also be able to create pages such as . A user will be able to create up to 10 pages with usernames, and unlimited pages under his username. Also, I don’t want to use the “?=” notation at all, only URLs with slashes. for example will lead to my photos. will be the same. How do I implement the URL? I know it works in my blog [wordpress], but not on the main website.

Best Regards,

Uri Even-Chen

Mobile Phone: +972-50-9007559



As you are new to Yii… it would be best to red the Definitive guide to Yii… it will give you some answers, and some ideas what you can do with Yii

also check post here

yes you can do such urls via url manager and between .htaccess rewrite methods are also in apache ;)

you can use Yii to build powerful social networks


only difference in php and php frameworks, frameworks such as yii has predefined classes in it, so it helps to reduce your coding work and no doubt yii is v.speedy and fastest php framework.

Yii yiic and Gii tool helps you to create your basic structure of your code v.easily

Thanks for your advice.

Uri Even-Chen.

It happen that I wrote an article about exactly this - advantages and disadvantages of framework programming, with a special reference to Yii framework. If you are interested in reading it, please contact my via PM (personal message) and I’ll send it a copy of that article.

Why not share the article here?

I think that Yii is pretty lean compared to ‘other’ frameworks “out there”.

It’s not too rigid so you can easily mix it up with your own code and/or other peoples code.

Of course it also means that it doesn’t hold your hand as much as ‘other frameworks’ do.

It just feels right for me - and that’s the most important thing: if a framework is not your particular cup of tea, then choose something else.

Sometimes you can point your finger at it, sometimes not.

Sure, you can roll your own framework, but…

Do you want to leverage the expertise of other people?

Become part of a community?

Save the good and interesting programming bits for yourself, instead of being tied up writing glue code all the time?

Granted, if you’ve got 10 years of experience from the field, you probably already have a bunch of reusable code handy… :)

Like were? A cookbook article? I’m not sure, if it is enough Yii-oriented to be published there.

I’ve sent it to Qiang with proposition of publishing somewhere and got reply that article is OK (with few minor corrections) but no reference to publishing it among community! :] Therefore I assumed that it is it much theoretical bla bla bla to be shared among specific Yii community! :}

Well, if it doesn’t belong in the Yii cookbook, where would it fit?

Post it! :)

As long as it has a Yii angle.

Of course, if you have a blog you could post it there, but why not here?

As a part of preparation for above mentioned article I’ve read two or three Ph.D. theses about theoretical background and all the work done upon creating own framework. All I can say after that reading is that Qiang has done something that only a really small group of people on this planet is able to do! I don’t know like others, but I personally would have to be hit by a low flying airplane, directly to my head, to get at least thinking of creating own framework! :]

Yeah… and after all those years you wake up one day or another and see what a person like Qiang done within only three years, which is far, far better than this bunch of reusable code and you think to yourself: Damn, I was stupid! ;} :} ;}

You can post it as an attach to the forum post… in the miscellaneous forum for example…

Don’t forget that Qiang has experience from Prado, but incredible none the less. :)

But, let’s not forget the rest of the awesome Yii team.

Nope! :( Can’t post it anywhere. I have access only to Word 2010, which produces enormously huge PDFs and I don’t have enough quota left to post it! :(

Google docs?

Kidding me? :) I’m as far from anything that Google touches as I can (if I can)! :]

Correction: I looked at the wrong version of a document. Last one magically became smaller and I was able to post it:

Advantages and Disadvantages of Framework Programming

Even then, a good solid active framework is wonderful to find!

I’ve converted most of my favorite reusable items into Components which I can plug into Yii and get the best of both worlds! ;)

I have a similar requirement and the only way I know that this can be done is by using an extension called dburlmanager -

Does anybody know of any other ways?

For permanent pages you could consider using urlManager with including index.php in address turned off and by creating new controller (for example aboutController) with default action showing contents of that page. But this is as ugly solution as we can imagine. Therefore, your idea with using that extension sounds much more reasonable.

For non-permanent user creatable pages, I would rather consider using .htaccess file or permanently configuring Apache server so it would threat (redirect) pages like to for example Then you could create simple usersController with showuser action to show whatever you want for passed username.

Since htaccess is already being used to redirect all requests via index.php, how would that work? Also how will it determine that refers to a user page, rather than another page on the site?

Note that if the file with that name exists on the server… .htaccess will redirect to that file


# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


As for other situation… like if you have a page "about" and a user has a username "about"… that is on you to solve…