I developed a model management script that I would like to make available for the public but I don’t want to release it “as is”. I want to convert it to Yii to make it cleaner and more efficient. I am in no way new to web development but I am somewhat new to Yii. I have built a few simple sites with Yii before but nothing on a level like this.
So I guess my question is, is there an easy way of going about converting my php script to Yii? Maybe some tutorials, examples, software for converting?
Thanks in advance, Jason.
No, there’s no easy way and it depends on what exactly your script does.
It does a little of everything. It has a custom email client… It is all database driven… It uses basic PHP functionality apart from the Email Client itself. A lot of reading and writing to the database.
And a lot of jquery for the theme.
Then at least you’ll have to:
Make sure your email class works fine in Yii environment. Since there’s no standard one it will be OK. Consider making it an application component for better usability.
If you already have it in production you have to keep URLs the same. That possibly means heavy usage of Yii routing and its rules.
Check if your DB queries are simple CRUD or not. If yes then consider using ActiveRecord. If not then either use query builder or Yii::app()->db->createCommand.
jQuery is Yii’s default clientside libraray so you’ll need to throw away your own copy and use Yii::app()->clientScript->registerPackage(‘jquery’) instead.
Of course, you’ll need to move your markup into Yii layout and views. Shouldn’t be that hard.