Transition To Yii Framework


I’m just learning about the Yii framework and have the following question: A few months ago I started developing a websystem based on ‘traditional’ languages (php, html, javascript/jquery). That was also my first experience with those languages. Then I read about the php frameworks including Yii and the advantages of rapid prototype development and now I’m thinking of moving to the Yii development framework. My question (and dilemma): how easy/difficult is it to rewrite the existing (php/html/javascript/jquery) code to code for the yii platform? I developed a few webpages with formfields that are created (and be deleted) dynamiccally using jquery. Another page includes a lot of javascript code for performing some complex calculations.With my current little knowlegde I’m not sure whether I can reuse some of my current code or whether it’s going to be a pain to create such kind of dynamic webpages with Yii?

Appreciate your views on this.


Good idea is first of all to follow yii blog tutorial (if you haven’t yet).

As the next step, the system you describe can be a good studying project. If this system is in a production mode, and won’t be changed a lot, you may leave it as it is, creating the same functionalities with yii at localhost, for example, that would give you a chance to study framework and get accustomed to it. After finishing this project, I think, you will be able to decide if to replace production with a new setup.

Actually, you don’t need or have to use any framework all the time, everything depends on specific needs of a specific project. And if it’s very small and doesn’t require a lot of coding or a lot of specific functionalities frameworks usually provide, it’s normal to go with plain php + js, using a couple third-party classes / libraries if needed.

Oh, and welcome to forum :)

I usually do not recommend frameworks to PHP-freshers (no offense!) as they will miss a lot of (learning) experience with vanilla PHP. It’s a bit sad you’re not telling us a bit more about your existing knowledge regarding programming languages and frameworks. I see jQuery being listed in your post; are you comfortable with it? I’m asking because jQuery is to JavaScript as Yii is to PHP (at lerast that’s often my experience :lol: )

As for your original question: If your application is really small, porting it to Yii might be a fun exercise. But as Yugene already said, you’d better finish the blog tutorial first.

As a general rule of thumb: The closer an existing application adheres to the MVC pattern, the easier it is to port to another framework.