This should have been addressed a long time ago with her doctor. It may be physical or mental but you need to know so that your daughter can get the help needed to not suffer any longer.
She has been vomiting now for around 2 years. I don't know if it has to do with what she ate cause she vomits no matter what. Usually she vomits at night while sleeping, but she is awaken by coughing then she vomits. Other times she vomits when told to start reading or writing, as in learning something. So we not sure if she does it on purpose because she don't want to learn or she simply sick. Luckily she don't vomit at school she only vomited like once or twice if at all, so no problems at school I think.
How long has it been going on ,can you pinpoint what she has eaten prior to the vomitting, what time of day does this happen , is it before she goes to school could she have any problem at school./does she vomit at school or only at home . If it has been going on for more than a few days I suggest a check up at the Doctors is in order. Good Luck