/unicorn-farm

An API built with symfony and documented with swagger_php.

Primary LanguagePHP

Unicorn Farm

Intro

Our unicorn farm is finally getting some traction and we decided to venture into the world wide web. We have no clue what we are doing and instead of automating the shopping and ordering workflow, we feel like it is more important to get our brand new unicorn Guestbook out there. On this guestbook unicorn enthusiasts can leave messages to us and other like-minded people. Since we're unicorn breeders and have no front-end skills, we decided the best approach would be to just create a guestbook API - someone else will surely create a good frontend for this. Because we still believe in fairy tales we don't see the need for authentication or user-management - people on the internet would not lie about who they are anyway. The gods - infuriated by the creation of unicorns - have decided we only get a PHP webserver, forcing us to create the API in everyone's most loved framework: Symfony.

API Documentation

Import web/swagger.json file into Postman as a collection.

Project Requirements:

  • Symfony project
  • The API will be a public api
  • Since the API is public, documentation is crucial
  • No authentication
  • No user management

API Requirements:

  • I should be able to get a list of all the unicorns at the farm
  • I should be able to create a post in my name
  • I should be able to link a new (or existing) post to my favourite unicorn
  • I should be able to fix a typo I made in my post
  • I should be able to see all posts that were made
  • I should be able to see all posts someone specific has made
  • I should be able to delete a post I made
  • I should be able to purchase a unicorn, which should delete all posts linked to my unicorn
  • I should be able to read up on the documentation where I can easily see what/how I can do
  • I should be able to easily and clearly identify what is going wrong in case something does go wrong
  • I should receive an email congratulating me and sending me the amount of posts that were made for my newly bought unicorn

TODO

  • Update to PHP7 and install swiftmailer-bundle
  • Update to PHP7 and add Scalar type hints
  • Update to PHP7 and add Return type declarations
  • Improve response codes
  • Improve documentation by adding all response codes in Swagger responses
  • Improve documentation by adding object schema in Swagger responses