Reply to thread

Like [USER=15674]@BIOS[/USER] mentioned, you'd be doing your self a service to use a framework like Slim or Lumen (I'd argue that you should just use Laravel instead of Lumen). Or even using composer to pull in widely used packages, instead of trying to reinvent the wheel. I'd also recommend following PSR's, especially PSR-12 and PSR-1, so that when you do share code, it's formatted in a standard way.


As for the code you provided:

  • I'd be more interested in how you interact with the API. Explain what the endpoints will be, and how you'll handle auth (as if you're providing documentation to your client).
  • An API should be consistent in what content-type it returns. By that I mean, it should always return JSON (or XML, CSV, etc, but be consistent), so that the API consumer has a general expectation of how to parse the response. So when you return an error, that should also be consistent; it appears that you've done this to extent, but not when there's a >400 status code.
  • Instead of returning [ICODE]No Volunteers Found[/ICODE], simply return an empty array.


Top