This is an API to provide recipes and ratings, based on the Gousto API Test requirements document. It is built using PHP and the Lumen framework.
- Apache
PHP >= 5.6composer- Command line access
- Clone this repo to a suitable location
- Configure an Apache
VirtualHost, and set theDocumentRootto/path/to/cloned/repo/public - Add the configured hostname to your hosts file
- On the command line, navigate to the repo root, and run
composer install
- Use your favourite REST client (or
curl) – full API specifications - To enable debug mode and see detailed error messages, update the
.envfile with
API_DEBUG=true
Gousto\
app/Gousto
- To run tests, navigate to repo root
- For unit tests, run:
./vendor/bin/phpunit -c gousto-unit.xml- For acceptance tests, run:
./vendor/bin/phpunit -c gousto-acceptance.xml
tests/Gousto/Unit/Tests
tests/Gousto/Acceptance/Tests
- Lumen was chosen as the framework due to:
- Familiarity
- Easy to bootstrap
- Suitable for RESTful APIs
- Performance as a micro-framework
- API built with extendability in mind
- Most components bound to interfaces and dependency injected for loose coupling
- Trivial to swap/add new components
- Adhering to SOLID principles
- Different API consumers can take advantage of dependency injectable transformers
- Allows different API responses with different data based on context of request (e.g. from web or mobile)
- Some shortcuts taken (e.g. in the
JsonModelorRatingService) to work around lack of proper database engine