Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to place "common" classes in YII Framework structure?

Tags:

yii

I need to create a few classes and would like some help on where this would go in the YII Framework. I know if I create a Model, it must go in the "models" directory. And by the same logic I know where "views", "controllers" etc would go. However, where would the following be placed in my web application:

  1. A class that contains a variety of "number" functions such as currency conversion, metric conversions etc?
  2. A class that interacts with a REST API? (It interacts with the database)

Any tips?

like image 730
coderama Avatar asked Dec 14 '25 17:12

coderama


2 Answers

To get started with adding custom classeses on YII you can check below link.

http://www.yiiframework.com/wiki/165/understanding-autoloading-helper-classes-and-helper-functions/

Hope it'll help you to start.

like image 124
Dhaval Avatar answered Dec 18 '25 20:12

Dhaval


You can find an example here, it is pretty detailed in my opinion:

The directory structure of the Yii project site

like image 39
ragklaat Avatar answered Dec 18 '25 20:12

ragklaat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!