I took a quick look and maybe a couple suggestions.
I do not generally do this but it is something that I should and is a good suggestion. Coding style, take a look at how Laravel maintains readable code. Simple example, https://github.com/laravel/laravel/blob/master/app/Providers/AuthServiceProvider.php they have spacing, doc blocks, etc - that make the code all very readable and provides some documentation at the same time.
Maybe changing these functions to use the config/default message instead of a hard-coded function default, might be something to look at.
https://github.com/Anshdesire/ApiResponse/blob/master/src/ApiResponse.php#L148
public function respondNotFound($message = "Resource not found!")
{
return $this->setStatusCode($this->STATUS_CODE[404])->respondWithError($message);
}
public function respondInternalError($message = "Internal server error")
{
return $this->setStatusCode($this->STATUS_CODE[500])->respond([],$message,[]);
}
I did not see anything else in my quick look, but i do see how the package will be useful. I might end up using this in a project later, so that I do not have to reinvent the wheel.
Hope that helps :)
Thank you so much porter and you can point right there also :) I have followed all your points and will release it soon.
:)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community