Http response codes (no helper class) #19864
-
Hi there, I am new to this framework so, this question might be trivial. I am trying to set statusCode on my rest api and lets say for 401 code i need to write like
i was checking if there is a helper class and so that i can get some constants for http response codes like
I do not want to write any helper class for this myself so I checked if Yii2 has any helper for this.. There is none if I am not mistaken. I do not want to do something like this because its just overkill:
So, for now I am using symfonys helper class:
I just wanted to state that would be nice if Yii2 has something similar.. Best regards |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
We are not planning to add constants for that. List of statuses is available at |
Beta Was this translation helpful? Give feedback.
-
Thanks for quick reply @bizley . The aim is actually writing a more readable code, one can find codes easily. But, allright I noted that its not on future plans |
Beta Was this translation helpful? Give feedback.
-
Why not use helper from Yii3? |
Beta Was this translation helpful? Give feedback.
We are not planning to add constants for that. List of statuses is available at
yii\web\Response::$httpStatuses
.